From 3a1e4fdc3c5141154d6a51754591feed11fde699 Mon Sep 17 00:00:00 2001 From: Tom Neuber Date: Mon, 30 Dec 2024 23:12:23 +0100 Subject: [PATCH] fix(metrics): add cumulative count as histogram expects --- internal/exporter/metrics.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/exporter/metrics.go b/internal/exporter/metrics.go index 8f6d036..f672de9 100644 --- a/internal/exporter/metrics.go +++ b/internal/exporter/metrics.go @@ -193,10 +193,12 @@ func (m *Metrics) collectReqeustDataMetrics(ch chan<- prometheus.Metric, queue * sum += latency count++ + var cumulativeCount uint64 for _, bound := range bucketBounds { if latency <= bound { - buckets[bound]++ + cumulativeCount++ } + buckets[bound] += cumulativeCount } }