Merge pull request 'fix(metrics): correct cumulative count calculation' (#58) from tn-fix-histogram-quantile-monotonicity into main
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/deploy Pipeline was successful

Reviewed-on: #58
This commit is contained in:
Tom Neuber 2024-12-30 23:49:42 +01:00
commit 6d73400416

View file

@ -193,15 +193,19 @@ func (m *Metrics) collectReqeustDataMetrics(ch chan<- prometheus.Metric, queue *
sum += latency
count++
var cumulativeCount uint64
for _, bound := range bucketBounds {
if latency <= bound {
cumulativeCount++
buckets[bound]++
}
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,