sumitagrawl commented on code in PR #10384:
URL: https://github.com/apache/ozone/pull/10384#discussion_r3360460490


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/metrics/ReconScmContainerSyncMetrics.java:
##########
@@ -53,14 +77,22 @@ public final class ReconScmContainerSyncMetrics {
    */
   public static final int TARGETED_SYNC_STATUS_FAILURE = 3;
 
-  @Metric(about = "Targeted sync status: 0=idle, 1=in progress, "
-      + "2=success, 3=failure")
-  private MutableGaugeInt targetedSyncStatus;
-
-  @Metric(about = "Time taken by the last targeted sync in milliseconds")
-  private MutableGaugeLong lastTargetedSyncDurationMs;
+  private final AtomicInteger targetedSyncStatus = new AtomicInteger();
+  private final AtomicLong lastTargetedSyncDurationMs = new AtomicLong();
+  private final Map<HddsProtos.LifeCycleState, AtomicLong>
+      lastContainerSyncDurationMs;
+  private final Map<HddsProtos.LifeCycleState, AtomicLong>
+      lastContainerCountDrift;

Review Comment:
   we need not capture last metrics of ContainerSync / Count / duration as this 
will be captured by grafana



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/metrics/ReconScmContainerSyncMetrics.java:
##########
@@ -17,25 +17,49 @@
 
 package org.apache.hadoop.ozone.recon.metrics;
 
+import com.google.common.base.CaseFormat;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsInfo;
+import org.apache.hadoop.metrics2.MetricsRecordBuilder;
+import org.apache.hadoop.metrics2.MetricsSource;
 import org.apache.hadoop.metrics2.MetricsSystem;
-import org.apache.hadoop.metrics2.annotation.Metric;
 import org.apache.hadoop.metrics2.annotation.Metrics;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
-import org.apache.hadoop.metrics2.lib.MutableGaugeInt;
-import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
+import org.apache.hadoop.metrics2.lib.Interns;
 import org.apache.hadoop.ozone.OzoneConsts;
 
 /**
  * Metrics for Recon SCM targeted sync execution.
  */
 @InterfaceAudience.Private
 @Metrics(about = "Recon SCM Container Sync Metrics", context = 
OzoneConsts.OZONE)
-public final class ReconScmContainerSyncMetrics {
+public final class ReconScmContainerSyncMetrics implements MetricsSource {
 
   private static final String SOURCE_NAME =
       ReconScmContainerSyncMetrics.class.getSimpleName();
 
+  private static final HddsProtos.LifeCycleState[] SYNC_STATES = {
+      HddsProtos.LifeCycleState.OPEN,
+      HddsProtos.LifeCycleState.QUASI_CLOSED,
+      HddsProtos.LifeCycleState.CLOSED,
+      HddsProtos.LifeCycleState.DELETED
+  };
+
+  private static final MetricsInfo TARGETED_SYNC_STATUS = Interns.info(
+      "targetedSyncStatus",

Review Comment:
   can be renamed as scmContainerSyncStatus



-- 
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