Naireen commented on code in PR #34275:
URL: https://github.com/apache/beam/pull/34275#discussion_r1996399018


##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/ReadFromKafkaDoFn.java:
##########
@@ -454,7 +454,9 @@ public ProcessContinuation processElement(
       final Stopwatch sw = Stopwatch.createStarted();
 
       while (true) {
-        rawRecords = poll(consumer, kafkaSourceDescriptor.getTopicPartition());
+        KafkaMetrics kafkaMetrics = KafkaSinkMetrics.kafkaMetrics();
+        rawRecords = poll(consumer, kafkaSourceDescriptor.getTopicPartition(), 
kafkaMetrics);
+        kafkaMetrics.flushBufferedMetrics();

Review Comment:
   I didn't do it because of the returns, but apparently the finally block will 
run and then return, so that will work. I have modified the code. 



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to