kfaraz commented on code in PR #17581:
URL: https://github.com/apache/druid/pull/17581#discussion_r1909043968
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java:
##########
@@ -1633,6 +1633,14 @@ private Pair<Map<String, Object>, Map<String, Object>>
doGetRowStatsAndUnparseab
);
buildSegmentsRowStats.addRowIngestionMetersTotals(rowStatsForRunningTasks);
+ // Emit the processed bytes metric
+ try {
+ emitMetric(toolbox.getEmitter(), "ingest/processed/bytes",
rowStatsForRunningTasks.getProcessedBytes());
+ }
+ catch (Exception e) {
Review Comment:
I don't think you need a try-catch here. `rowStatsForRunningTasks` should
always be non-null afaict.
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunner.java:
##########
@@ -657,6 +658,24 @@ public void run()
shouldProcess
);
+ long bytesProcessed = 0;
+ for (ByteEntity entity : record.getData()) {
+ bytesProcessed += entity.getBuffer().remaining();
+ }
+
+ // Emit the processed bytes metric
+ try {
+ toolbox.getEmitter().emit(
+ ServiceMetricEvent.builder()
+ .setDimension("taskId", task.getId())
+ .setDimension("dataSource", task.getDataSource())
+ .setMetric("ingest/processed/bytes", bytesProcessed)
+ );
+ }
+ catch (Exception e) {
Review Comment:
Probably don't need a try-catch.
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -529,6 +532,31 @@ private MSQTaskReportPayload runInternal(final
QueryListener queryListener, fina
countersSnapshot,
null
);
+ // Emit summary metrics
+ emitSummaryMetrics(msqTaskReportPayload, querySpec);
+ return msqTaskReportPayload;
+ }
+
+ private void emitSummaryMetrics(final MSQTaskReportPayload
msqTaskReportPayload, final MSQSpec querySpec)
+ {
+ long totalProcessedBytes = msqTaskReportPayload.getCounters() != null
+ ?
msqTaskReportPayload.getCounters().copyMap().values().stream().mapToLong(
+ integerCounterSnapshotsMap ->
integerCounterSnapshotsMap.values().stream()
+ .mapToLong(counterSnapshots -> {
+ Map<String, QueryCounterSnapshot> workerCounters =
counterSnapshots.getMap();
+ return workerCounters.entrySet().stream().mapToLong(
+ channel -> {
+ if (channel.getKey().startsWith("input")) {
+ ChannelCounters.Snapshot snapshot =
(ChannelCounters.Snapshot) channel.getValue();
+ return snapshot.getBytes() == null ? 0L :
Arrays.stream(snapshot.getBytes()).sum();
+ }
+ return 0L;
+ }).sum();
+ }).sum()).sum()
+ : 0;
+
+ log.info("Total processed bytes: %d, query: %s", totalProcessedBytes,
querySpec.getQuery());
Review Comment:
This can be a debug log.
```suggestion
log.debug("Processed bytes[%d] for query[%s].", totalProcessedBytes,
querySpec.getQuery());
```
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunner.java:
##########
@@ -657,6 +658,24 @@ public void run()
shouldProcess
);
+ long bytesProcessed = 0;
+ for (ByteEntity entity : record.getData()) {
+ bytesProcessed += entity.getBuffer().remaining();
+ }
+
+ // Emit the processed bytes metric
+ try {
+ toolbox.getEmitter().emit(
+ ServiceMetricEvent.builder()
+ .setDimension("taskId", task.getId())
+ .setDimension("dataSource", task.getDataSource())
Review Comment:
Instead of this, you could use `IndexTaskUtils.setTaskDimensions()` to set
all task related dimensions.
--
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]