zentol commented on a change in pull request #8886: [FLINK-12987][metrics] fix DescriptiveStatisticsHistogram#getCount() not returning the number of elements seen URL: https://github.com/apache/flink/pull/8886#discussion_r309586303
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/DescriptiveStatisticsHistogram.java ########## @@ -22,25 +22,30 @@ import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; +import java.util.concurrent.atomic.AtomicLong; + /** * The {@link DescriptiveStatisticsHistogram} use a DescriptiveStatistics {@link DescriptiveStatistics} as a Flink {@link Histogram}. */ public class DescriptiveStatisticsHistogram implements org.apache.flink.metrics.Histogram { private final DescriptiveStatistics descriptiveStatistics; + private final AtomicLong elementsSeen = new AtomicLong(); Review comment: All metrics are read in a multi-thread context; the reporter thread and MetricQueryService can run concurrently. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services