devabhishekpal commented on code in PR #7835:
URL: https://github.com/apache/ozone/pull/7835#discussion_r1959104827
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/metrics/ReconOmTaskMetrics.java:
##########
@@ -0,0 +1,104 @@
+package org.apache.hadoop.ozone.recon.metrics;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsRecordBuilder;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsTag;
+import org.apache.hadoop.metrics2.annotation.Metric;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.metrics2.lib.MetricsRegistry;
+import org.apache.hadoop.metrics2.lib.MutableCounterLong;
+import org.apache.hadoop.metrics2.lib.MutableRate;
+
+/**
+ * This interface is to be implemented by the various metrics for different
tasks
+ */
+public abstract class ReconOmTaskMetrics implements MetricsSource {
+
+ private final MetricsRegistry registry = new MetricsRegistry("ReconOMTasks");
+ private final String taskName;
+ private final String source;
+
+ private @Metric MutableCounterLong reprocessCount;
+ private @Metric MutableCounterLong reprocessFailedCount;
+ private @Metric MutableRate reprocessLatency;
+
+ private @Metric MutableCounterLong processCount;
+ private @Metric MutableCounterLong processFailedCount;
+ private @Metric MutableRate processLatency;
+
+ protected ReconOmTaskMetrics(String taskName, String source) {
+ this.taskName = taskName;
+ this.source = source;
+ }
+
+ /**
+ * Update the number of reprocess() method calls by the task
+ */
+ public void incrTaskReprocessCount() {
Review Comment:
So in this case we are incrementing the count in the beginning to track how
many times the method was called.
There is another counter `reprocessFailedCount` which tracks the number of
times the method failed/encountered exception.
The number of successful runs can be found by `reprocessCount -
reprocessFailedCount`.
--
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]