diff --git a/internal/exporter/metrics.go b/internal/exporter/metrics.go index ba593f8..f672de9 100644 --- a/internal/exporter/metrics.go +++ b/internal/exporter/metrics.go @@ -193,19 +193,15 @@ 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 } } - var cumulativeCount uint64 - for _, bound := range bucketBounds { - cumulativeCount += buckets[bound] - buckets[bound] = cumulativeCount - } - m.counter += uint(len(data)) ch <- prometheus.MustNewConstMetric( m.metricRequestsTotal,