You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/02/09 02:39:46 UTC

[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #6549: Adding metrics for minion tasks status

fx19880617 commented on a change in pull request #6549:
URL: https://github.com/apache/incubator-pinot/pull/6549#discussion_r572525360



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java
##########
@@ -478,4 +489,34 @@ public void cleanUpTask() {
   public Scheduler getScheduler() {
     return _scheduledExecutorService;
   }
+
+  public synchronized void reportMetrics(String taskType) {
+    Map<String, TaskState> taskStates = _helixTaskResourceManager.getTaskStates(taskType);
+    Map<TaskState, Integer> taskStateToCountMap = new HashMap<>();
+    for (String taskName : taskStates.keySet()) {
+      TaskState taskState = taskStates.get(taskName);
+      if (!taskStateToCountMap.containsKey(taskState)) {
+        taskStateToCountMap.put(taskState, 0);
+      }
+      taskStateToCountMap.put(taskState, taskStateToCountMap.get(taskState) + 1);
+    }
+    // Reset all the status to 0
+    for (TaskState taskState : _taskStateToCountMap.keySet()) {

Review comment:
       it's not, as we need to update the already reported metrics.
   e.g.
   in run 1, we report:
   ```
   pinot_controller_taskStatus_Value{status="IN_PROGRESS",taskType="SegmentGenerationAndPushTask",} 0.0
   ```
   in run 2, we need report:
   ```
   pinot_controller_taskStatus_Value{status="IN_PROGRESS",taskType="SegmentGenerationAndPushTask",} 0.0
   pinot_controller_taskStatus_Value{status="COMPLETED",taskType="SegmentGenerationAndPushTask",} 1.0
   ```
   Without tracking the previous metrics, we cannot reset the value.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org