[GitHub] [flink] NicoK commented on a change in pull request #8886: [FLINK-12987][metrics] fix DescriptiveStatisticsHistogram#getCount() not returning the number of elements seen
NicoK 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_r314395738 ## 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: Seems like the underlying code is not thread-safe anyways and we provide only best-effort metrics. I reverted to just using a `long` now. 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
[GitHub] [flink] NicoK commented on a change in pull request #8886: [FLINK-12987][metrics] fix DescriptiveStatisticsHistogram#getCount() not returning the number of elements seen
NicoK 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_r298395591 ## 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: that depends on how users use it - usually, there should be >=1 writer thread(s), e.g. from a task and potentially also spawned user-threads, and 1 reader (the metrics reporter) 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
[GitHub] [flink] NicoK commented on a change in pull request #8886: [FLINK-12987][metrics] fix DescriptiveStatisticsHistogram#getCount() not returning the number of elements seen
NicoK 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_r298395591 ## 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: that depends on how users use it - usually, there should be >=1 writer thread(s) (tasks) and 1 reader (the metrics reporter) 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