fix(metrics): correct cumulative count calculation
This commit is contained in:
parent
3a1e4fdc3c
commit
53954090a3
1 changed files with 7 additions and 3 deletions
|
@ -193,15 +193,19 @@ func (m *Metrics) collectReqeustDataMetrics(ch chan<- prometheus.Metric, queue *
|
||||||
sum += latency
|
sum += latency
|
||||||
count++
|
count++
|
||||||
|
|
||||||
var cumulativeCount uint64
|
|
||||||
for _, bound := range bucketBounds {
|
for _, bound := range bucketBounds {
|
||||||
if latency <= bound {
|
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))
|
m.counter += uint(len(data))
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
m.metricRequestsTotal,
|
m.metricRequestsTotal,
|
||||||
|
|
Loading…
Reference in a new issue