neha-ellur commented on code in PR #17581:
URL: https://github.com/apache/druid/pull/17581#discussion_r1889633314


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -329,6 +331,27 @@ public void run(final QueryListener queryListener) throws 
Exception
     }
     // Call onQueryComplete after Closer is fully closed, ensuring no 
controller-related processing is ongoing.
     queryListener.onQueryComplete(reportPayload);
+
+    long totalProcessedBytes = 
reportPayload.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();
+
+    log.info("Total processed bytes: %d", totalProcessedBytes);
+    context.emitMetric("ingest/processed/bytes", totalProcessedBytes);

Review Comment:
   Referencing this logic from here 
https://github.com/implydata/imply-cloud/blob/7ab988827dfb2f0c5b811bb1e8b8d5beed90bc94/saas/src/main/java/io/imply/cloud/saas/manager/taskreports/MsqTaskReport.java#L51
   
   Is there another way to fetched the processed bytes metric for msq?



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