Merge pull request 'fix(metrics): correct cumulative count calculation' (#58) from tn-fix-histogram-quantile-monotonicity into main
Reviewed-on: #58
This commit is contained in:
commit
6d73400416
1 changed files with 7 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue