sodonnel commented on code in PR #5688:
URL: https://github.com/apache/ozone/pull/5688#discussion_r1409025390


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeDecommissionMetrics.java:
##########
@@ -135,10 +135,13 @@ public long getUnhealthyContainers() {
 
   private Map<String, ContainerStateInWorkflow> metricsByHost;
 
+  private Map<String, Long> startTimeByHost;
+
   /** Private constructor. */
   private NodeDecommissionMetrics() {
     this.registry = new MetricsRegistry(METRICS_SOURCE_NAME);
     metricsByHost = new HashMap<>();
+    startTimeByHost = new HashMap<>();

Review Comment:
   One way, would be to modify:
   
   ```
   private Set<DatanodeDetails> trackedNodes = new HashSet<>();
   ```
   To be a set of TrackedDatanode, where TrackedDatanode is a public inner 
class within DatanodeAdminMonitorImpl, where it wraps the datanodeDetails and 
the start time, along with potentially other fields - eg, we could also store 
the counters we are passing to the metric in there if we wanted, but to start 
with, it would make sense to just try the startTime and see how it looks, then 
we could expand it if needed.
   
   Then when forming the object to pass to the metrics on each iteration we can 
pull the details from there.
   
   As I type this, I looked at the ContainerStateInWorkflow class, which is 
nearly the same thing in the metrics class, only it gets cleared each time.
   
   If we created a TrackedDatanode object, we may be able to simplify away the 
use of the `private Map<String, ContainerStateInWorkflow>` in 
DatanodeAdminMonitor, but I would start small and see if the TrackedNode object 
to track the start time makes sense to begin with.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to