prom-client icon indicating copy to clipboard operation
prom-client copied to clipboard

fix: always use sum aggregator for sum & count

Open raghuram-periaswamy opened this issue 3 years ago • 1 comments

sum & count metrics of summary & histogram should always be summed irrespective of the custom aggregator that's mentioned as part of the metric definition.

Previously, aggregating the following two sample sets

set-1

http_duration_seconds{quantile="0.95"} 4
http_duration_seconds_sum 10
http_duration_seconds_count 5

set-2

http_duration_seconds{quantile="0.95"} 6
http_duration_seconds_sum 20
http_duration_seconds_count 5

using average yields the following where every metric is averaged.

http_duration_seconds{quantile="0.95"} 5
http_duration_seconds_sum 15
http_duration_seconds_count 5

The fix will always perform sum for the sum & count yielding,

http_duration_seconds{quantile="0.95"} 5
http_duration_seconds_sum 30
http_duration_seconds_count 10

raghuram-periaswamy avatar Jan 11 '22 09:01 raghuram-periaswamy

@SimenB @zbjornson Requesting for the review.

raghuram-periaswamy avatar Jan 25 '22 08:01 raghuram-periaswamy