kfaraz commented on code in PR #13333:
URL: https://github.com/apache/druid/pull/13333#discussion_r1017905394


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/LocalTaskActionClient.java:
##########
@@ -72,14 +77,35 @@ public <RetType> RetType submit(TaskAction<RetType> 
taskAction)
 
     final long performStartTime = System.currentTimeMillis();
     final RetType result = taskAction.perform(task, toolbox);
-    emitTimerMetric("task/action/run/time", System.currentTimeMillis() - 
performStartTime);
+    emitTimerMetric("task/action/run/time", taskAction, 
System.currentTimeMillis() - performStartTime);
     return result;
   }
 
-  private void emitTimerMetric(final String metric, final long time)
+  private void emitTimerMetric(final String metric, final TaskAction<?> 
action, final long time)
   {
     final ServiceMetricEvent.Builder metricBuilder = 
ServiceMetricEvent.builder();
     IndexTaskUtils.setTaskDimensions(metricBuilder, task);
+    final String actionType = getActionType(toolbox.getJsonMapper(), action);
+    if (actionType != null) {
+      metricBuilder.setDimension("taskActionType", actionType);
+    }
     toolbox.getEmitter().emit(metricBuilder.build(metric, Math.max(0, time)));
   }
+
+  @Nullable
+  static String getActionType(final ObjectMapper jsonMapper, final 
TaskAction<?> action)
+  {
+    try {
+      final Map<String, Object> m = jsonMapper.convertValue(action, 
JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT);

Review Comment:
   This seems a bit overkill and would add an extra serde step on completion of 
every task action.
   Should we expose a `getType()` method on the TaskAction instead?



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