kyhtsang commented on code in PR #17581:
URL: https://github.com/apache/druid/pull/17581#discussion_r1922653109


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -529,6 +531,32 @@ 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 = 0;
+
+    if (msqTaskReportPayload.getCounters() != null) {
+      totalProcessedBytes = msqTaskReportPayload.getCounters()
+          .copyMap()
+          .values()
+          .stream()
+          .flatMap(counterSnapshotsMap -> 
counterSnapshotsMap.values().stream())
+          .flatMap(counterSnapshots -> 
counterSnapshots.getMap().entrySet().stream())
+          .filter(entry -> entry.getKey().startsWith("input"))
+          .mapToLong(entry -> {
+            ChannelCounters.Snapshot snapshot = (ChannelCounters.Snapshot) 
entry.getValue();
+            return snapshot.getBytes() == null ? 0L : 
Arrays.stream(snapshot.getBytes()).sum();
+          })
+          .sum();
+    }
+
+    log.debug("Processed bytes[%d] for query[%s].", totalProcessedBytes, 
querySpec.getQuery());
+    context.emitMetric("ingest/processed/bytes", totalProcessedBytes);

Review Comment:
   @neha-ellur if this is indeed what is reported in the task reports (i.e. 
what we meter on, after you confirm the table in the Jira), then we can use 
this name and either expose it as `ingest/processed/bytes` in the cube or hide 
it behind a measure in Detailed Metrics
   
   



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