This is an automated email from the ASF dual-hosted git repository.

yashmayya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 1eaf42c941 Update NUMBER_TASKS_EXECUTED meter only after execution is 
done (#14515)
1eaf42c941 is described below

commit 1eaf42c94168180f143bf2908b4788db1b138220
Author: Shounak kulkarni <[email protected]>
AuthorDate: Thu Nov 21 22:17:58 2024 +0530

    Update NUMBER_TASKS_EXECUTED meter only after execution is done (#14515)
---
 .../apache/pinot/minion/taskfactory/TaskFactoryRegistry.java  | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/pinot-minion/src/main/java/org/apache/pinot/minion/taskfactory/TaskFactoryRegistry.java
 
b/pinot-minion/src/main/java/org/apache/pinot/minion/taskfactory/TaskFactoryRegistry.java
index 00f4bbeac5..8b633fbbd2 100644
--- 
a/pinot-minion/src/main/java/org/apache/pinot/minion/taskfactory/TaskFactoryRegistry.java
+++ 
b/pinot-minion/src/main/java/org/apache/pinot/minion/taskfactory/TaskFactoryRegistry.java
@@ -145,11 +145,6 @@ public class TaskFactoryRegistry {
               String tableName = pinotTaskConfig.getTableName();
 
               _eventObserver.notifyTaskStart(pinotTaskConfig);
-              _minionMetrics.addMeteredValue(taskType, 
MinionMeter.NUMBER_TASKS_EXECUTED, 1L);
-              if (tableName != null) {
-                _minionMetrics.addMeteredTableValue(tableName, taskType,
-                    MinionMeter.NUMBER_TASKS_EXECUTED, 1L);
-              }
               LOGGER.info("Start running {}: {} with configs: {}", 
pinotTaskConfig.getTaskType(), _taskConfig.getId(),
                   pinotTaskConfig.getConfigs());
 
@@ -190,6 +185,12 @@ public class TaskFactoryRegistry {
                 }
                 LOGGER.error("Caught exception while executing task: {}", 
_taskConfig.getId(), e);
                 return new TaskResult(TaskResult.Status.FAILED, 
extractAndTrimRootCauseMessage(e));
+              } finally {
+                _minionMetrics.addMeteredValue(taskType, 
MinionMeter.NUMBER_TASKS_EXECUTED, 1L);
+                if (tableName != null) {
+                  _minionMetrics.addMeteredTableValue(tableName, taskType,
+                      MinionMeter.NUMBER_TASKS_EXECUTED, 1L);
+                }
               }
             }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to