mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
feat(prometheus): collect timer.Total() (#950)
feat(prometheus): collect timer.Total() (#817) Co-authored-by: Ömer Faruk Irmak <omerfirmak@gmail.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
parent
05108d108c
commit
5cd3c9d3b9
2 changed files with 4 additions and 0 deletions
|
|
@ -114,6 +114,7 @@ func (c *collector) addTimer(name string, m metrics.TimerSnapshot) {
|
||||||
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])
|
||||||
|
|
|
||||||
3
metrics/prometheus/testdata/prometheus.want
vendored
3
metrics/prometheus/testdata/prometheus.want
vendored
|
|
@ -60,6 +60,9 @@ test_resetting_timer {quantile="0.99"} 1.2e+08
|
||||||
# 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