mas-chen commented on code in PR #22303: URL: https://github.com/apache/flink/pull/22303#discussion_r1152679757
########## flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/KafkaWriter.java: ########## @@ -420,6 +420,7 @@ private void checkAsyncException() throws IOException { if (e != null) { asyncProducerException = null; + numRecordsOutErrorsCounter.inc(); Review Comment: The logic for counter is duplicated because it is possible for write/flush/WriterCallback-mailbox to throw the exception. When the exception is thrown, the counter should also be incremented. Ideally, we can increment the counter once when I detect the exception (inside the WriterCallback, before the mailbox) but we have no control over the Counter and it is not volatile. I also am questioning the value of such a counter because the exception should cause a DAG restart in which metrics should reset. However, the metric is already is exposed as public API, so we need to keep it -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org