mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
feat(prometheus): collect timer.Total() (#817)
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
parent
16cbc9a754
commit
e34a8cf79b
2 changed files with 4 additions and 0 deletions
|
|
@ -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}
|
pv := []float64{0.5, 0.75, 0.95, 0.99, 0.999, 0.9999}
|
||||||
ps := m.Percentiles(pv)
|
ps := m.Percentiles(pv)
|
||||||
c.writeSummaryCounter(name, m.Count())
|
c.writeSummaryCounter(name, m.Count())
|
||||||
|
c.writeSummaryCounter(mutateKey(name+"_total"), m.Total().Nanoseconds())
|
||||||
c.buff.WriteString(fmt.Sprintf(typeSummaryTpl, mutateKey(name)))
|
c.buff.WriteString(fmt.Sprintf(typeSummaryTpl, mutateKey(name)))
|
||||||
for i := range pv {
|
for i := range pv {
|
||||||
c.writeSummaryPercentile(name, strconv.FormatFloat(pv[i], 'f', -1, 64), ps[i])
|
c.writeSummaryPercentile(name, strconv.FormatFloat(pv[i], 'f', -1, 64), ps[i])
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,9 @@ test_meter 9999999
|
||||||
# TYPE test_timer_count counter
|
# TYPE test_timer_count counter
|
||||||
test_timer_count 6
|
test_timer_count 6
|
||||||
|
|
||||||
|
# TYPE test_timer_total_count counter
|
||||||
|
test_timer_total_count 230000000
|
||||||
|
|
||||||
# TYPE test_timer summary
|
# TYPE test_timer summary
|
||||||
test_timer {quantile="0.5"} 2.25e+07
|
test_timer {quantile="0.5"} 2.25e+07
|
||||||
test_timer {quantile="0.75"} 4.8e+07
|
test_timer {quantile="0.75"} 4.8e+07
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue