If I used a thread-safe counter implementation, would that be enough to make the count correct for a Flink cluster with multiple machines?
Best, Shane ________________________________ From: Zhanghao Chen <zhanghao.c...@outlook.com> Sent: March 4, 2022 11:08 PM To: Shane Bishop <shane.bis...@outlook.com>; user@flink.apache.org <user@flink.apache.org> Subject: Re: Question about Flink counters Hi Shane, Flink provides a generic counter interface with a few implementations. The default implementation SimpleCounter, which is not thread-safe, is used when you calling counter(String name) on a MetricGroup. Therefore, you'll need to use your own thread-safe implementation, check out the second example of Metrics | Apache Flink<https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/ops/metrics/#counter> for reference. Best, Zhanghao Chen ________________________________ From: Shane Bishop <shane.bis...@outlook.com> Sent: Saturday, March 5, 2022 5:24 To: user@flink.apache.org <user@flink.apache.org> Subject: Question about Flink counters Hi all, For Flink counters [1], are increment operations guaranteed to be atomic across all parallel tasks? I.e., is there a guarantee that the counter values will not be higher than expected? Thanks, Shane --- [1] https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/ops/metrics/#counter