FrankChen021 commented on code in PR #19674:
URL: https://github.com/apache/druid/pull/19674#discussion_r3578879203


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java:
##########
@@ -107,6 +109,23 @@ public static void emitSegmentPublishMetrics(
     }
   }
 
+  /**
+   * Emits the metric {@code segment/allocated/count}.
+   */
+  public static void emitSegmentAllocateMetric(SegmentIdWithShardSpec 
allocatedId, Task task, ServiceEmitter emitter)
+  {
+    final ServiceMetricEvent.Builder metricBuilder = new 
ServiceMetricEvent.Builder();
+    IndexTaskUtils.setTaskDimensions(metricBuilder, task);
+    if (task instanceof SeekableStreamIndexTask<?, ?, ?>) {
+      metricBuilder.setDimension(
+          DruidMetrics.SUPERVISOR_ID,
+          ((SeekableStreamIndexTask<?, ?, ?>) task).getSupervisorId()
+      );
+    }
+    metricBuilder.setDimension(DruidMetrics.ID, allocatedId.toString());
+    emitter.emit(metricBuilder.setMetric("segment/allocated/count", 1));

Review Comment:
   [P2] Register the new metric with stock emitters
   
   `segment/allocated/count` is absent from the default metric maps and 
allowlists used by Prometheus, StatsD, Dropwizard, OpenTSDB, Ambari, and 
Graphite. Their converters discard unknown metrics, so default installations 
silently lose every allocation event. Add the metric with the appropriate 
counter type and dimensions to the supported default maps.



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