TheNeuralBit commented on code in PR #17771:
URL: https://github.com/apache/beam/pull/17771#discussion_r887338327


##########
sdks/python/apache_beam/runners/worker/opcounters.py:
##########
@@ -219,9 +219,14 @@ def update_from_batch(self, windowed_batch):
     assert self.producer_batch_converter is not None
     assert isinstance(windowed_batch, windowed_value.HomogeneousWindowedBatch)
 
-    self.element_counter.update(
-        self.producer_batch_converter.get_length(windowed_batch.values))
-    # TODO(BEAM-14408): Update byte size estimate
+    batch_length = self.producer_batch_converter.get_length(
+        windowed_batch.values)
+    self.element_counter.update(batch_length)
+
+    mean_element_size = self.producer_batch_converter.estimate_byte_size(
+        windowed_batch.values) / batch_length
+    for _ in range(batch_length):
+      self.mean_byte_counter.update(mean_element_size)

Review Comment:
   Added `Counter.update_n` to address this.



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

Reply via email to