AMOOOMA commented on code in PR #26477:
URL: https://github.com/apache/beam/pull/26477#discussion_r1185321950
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java:
##########
@@ -1400,6 +1402,31 @@ public void close() {
// Blocks while executing work.
executionState.getWorkExecutor().execute();
+ // Reports source bytes processed to workitemcommitrequest if available.
+ try {
+ long sourceBytesProcessed = 0;
+ List<ElementCounter> counters =
+ ((DataflowMapTaskExecutor) executionState.getWorkExecutor())
+ .getReadOperation()
+ .receivers[0]
+ .getOutputCounters();
+ for (ElementCounter counter : counters) {
+ try {
+ Counter<Long, Long> baseCounter = ((OutputObjectAndByteCounter)
counter).getByteCount();
+ if (!baseCounter.getName().name().equals(counterName)) continue;
+ sourceBytesProcessed = (long) baseCounter.getAndReset();
+ } catch (Exception e) {
+ // Ignoring because most counter will crash, spamming the logs.
Review Comment:
Yeah that makes sense. Updated OutputReceiver to have a map instead of List
for easier access.
--
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]