feat(prometheus): collect timer.Total() (#817)

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
Ömer Faruk Irmak 2024-06-11 14:12:12 +03:00 committed by GitHub
parent 16cbc9a754
commit e34a8cf79b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -77,6 +77,7 @@ func (c *collector) addTimer(name string, m metrics.Timer) {
pv := []float64{0.5, 0.75, 0.95, 0.99, 0.999, 0.9999}
ps := m.Percentiles(pv)
c.writeSummaryCounter(name, m.Count())
c.writeSummaryCounter(mutateKey(name+"_total"), m.Total().Nanoseconds())
c.buff.WriteString(fmt.Sprintf(typeSummaryTpl, mutateKey(name)))
for i := range pv {
c.writeSummaryPercentile(name, strconv.FormatFloat(pv[i], 'f', -1, 64), ps[i])

View file

@ -84,6 +84,9 @@ test_meter 9999999
# TYPE test_timer_count counter
test_timer_count 6
# TYPE test_timer_total_count counter
test_timer_total_count 230000000
# TYPE test_timer summary
test_timer {quantile="0.5"} 2.25e+07
test_timer {quantile="0.75"} 4.8e+07