devabhishekpal commented on code in PR #7517:
URL: https://github.com/apache/ozone/pull/7517#discussion_r1868999885


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/TaskStatusService.java:
##########
@@ -50,4 +69,37 @@ public Response getTaskTimes() {
     List<ReconTaskStatus> resultSet = reconTaskStatusDao.findAll();
     return Response.ok(resultSet).build();
   }
+
+  @GET
+  @Path("metrics")
+  public Response getTaskMetrics() {
+    Map<ReconTaskStatusCounter.ReconTasks, Pair<Integer, Integer>> 
tasksPairMap = taskStatusCounter.getTaskCounts();
+    List<ReconTaskStatusCountResponse> tasks = new ArrayList<>();
+    for (Map.Entry<ReconTaskStatusCounter.ReconTasks, Pair<Integer, Integer>> 
entry: tasksPairMap.entrySet()) {
+      tasks.add(new ReconTaskStatusCountResponse(
+        entry.getKey().name(),
+        entry.getValue().getLeft(),
+        entry.getValue().getRight()
+      ));
+    }
+    return Response.ok(new ReconAllTasksCountResponse(tasks)).build();
+  }
+
+  @GET
+  @Path("metrics/{taskName}")
+  public Response getTaskMetrics(

Review Comment:
   Removed this in 
[5248373](https://github.com/apache/ozone/pull/7517/commits/5248373fede0a47e1475ef14730e4b443445b55d)
 as currently we do not use this endpoint



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/metrics/ReconTaskStatusCounter.java:
##########
@@ -0,0 +1,127 @@
+package org.apache.hadoop.ozone.recon.metrics;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static 
org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_TASK_STATUS_STORAGE_DURATION;
+import static 
org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_TASK_STATUS_STORAGE_DURATION_DEFAULT;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+public class ReconTaskStatusCounter {
+  private static ReconTaskStatusCounter instance;
+  private final long timeoutDuration;
+
+  public enum ReconTasks {
+    ContainerHealthTask,
+    ContainerKeyMapperTask,
+    ContainerSizeCountTask,
+    FileSizeCountTask,
+    NSSummaryTask,
+    OmDeltaRequest,
+    OmTableInsightTask,
+    OmSnapshotRequest,
+    PipelineSyncTask,
+    ReconScmTask
+  }
+
+  static long initializationTime = 0L;
+
+  static Map<ReconTasks, Pair<Integer, Integer>> taskStatusCounter= new 
EnumMap<>(ReconTasks.class);

Review Comment:
   Addressed in 
[5248373](https://github.com/apache/ozone/pull/7517/commits/5248373fede0a47e1475ef14730e4b443445b55d)



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