xichen01 commented on code in PR #6782:
URL: https://github.com/apache/ozone/pull/6782#discussion_r1631997974


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/CSMMetrics.java:
##########
@@ -61,26 +63,39 @@ public class CSMMetrics {
   private @Metric MutableCounterLong numDataCacheMiss;
   private @Metric MutableCounterLong numDataCacheHit;
   private @Metric MutableCounterLong numEvictedCacheCount;
+  private @Metric MutableCounterLong pendingApplyTransactions;
 
   private @Metric MutableRate applyTransactionNs;
   private @Metric MutableRate writeStateMachineDataNs;
+  private @Metric MutableRate untilApplyTransactionNs;
+  private @Metric MutableRate startTransactionCompleteNs;
 
-  public CSMMetrics() {
+  public CSMMetrics(RaftGroupId gid) {
+    this.gid = gid;
     int numCmdTypes = ContainerProtos.Type.values().length;
     this.opsLatencyMs = new MutableRate[numCmdTypes];
+    this.opsQueueingDelay = new MutableRate[numCmdTypes];
     this.registry = new MetricsRegistry(CSMMetrics.class.getSimpleName());
     for (int i = 0; i < numCmdTypes; i++) {
       opsLatencyMs[i] = registry.newRate(
           ContainerProtos.Type.forNumber(i + 1).toString() + "Ms",
           ContainerProtos.Type.forNumber(i + 1) + " op");
+      opsQueueingDelay[i] = registry.newRate(
+          "queueingDelay" + ContainerProtos.Type.forNumber(i + 1),
+          ContainerProtos.Type.forNumber(i + 1) + " op");
     }
   }
 
   public static CSMMetrics create(RaftGroupId gid) {
     MetricsSystem ms = DefaultMetricsSystem.instance();
     return ms.register(SOURCE_NAME + gid.toString(),

Review Comment:
   Is the closed Ratis `Pipeline` can be removed form the Metrics system? Will 
a Datanode that runs for a long time and has multiple Pipeline closes have many 
expired and invalid indicators?



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/CSMMetrics.java:
##########
@@ -216,6 +244,14 @@ public void incNumEvictedCacheCount() {
     numEvictedCacheCount.incr();
   }
 
+  public void incPendingApplyTransactions() {
+    pendingApplyTransactions.incr();
+  }
+
+  public void decPendingApplyTransactions() {

Review Comment:
   What if the transaction fails after `incPendingApplyTransactions` ? Will 
this cause a “metric leak”?



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/CSMMetrics.java:
##########
@@ -61,26 +63,39 @@ public class CSMMetrics {
   private @Metric MutableCounterLong numDataCacheMiss;
   private @Metric MutableCounterLong numDataCacheHit;
   private @Metric MutableCounterLong numEvictedCacheCount;
+  private @Metric MutableCounterLong pendingApplyTransactions;
 
   private @Metric MutableRate applyTransactionNs;
   private @Metric MutableRate writeStateMachineDataNs;
+  private @Metric MutableRate untilApplyTransactionNs;
+  private @Metric MutableRate startTransactionCompleteNs;
 
-  public CSMMetrics() {
+  public CSMMetrics(RaftGroupId gid) {
+    this.gid = gid;
     int numCmdTypes = ContainerProtos.Type.values().length;
     this.opsLatencyMs = new MutableRate[numCmdTypes];
+    this.opsQueueingDelay = new MutableRate[numCmdTypes];
     this.registry = new MetricsRegistry(CSMMetrics.class.getSimpleName());
     for (int i = 0; i < numCmdTypes; i++) {
       opsLatencyMs[i] = registry.newRate(
           ContainerProtos.Type.forNumber(i + 1).toString() + "Ms",
           ContainerProtos.Type.forNumber(i + 1) + " op");
+      opsQueueingDelay[i] = registry.newRate(
+          "queueingDelay" + ContainerProtos.Type.forNumber(i + 1),

Review Comment:
   Time units can be added.



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