From 7fce11d1f1665bf11c869d4206154a8543e9ee20 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Sat, 28 Feb 2026 20:52:33 +0800 Subject: [PATCH] fix(metrics): add missing ResettingTimer case in GetAll() #33749 (#2038) Follow-up to https://github.com/ethereum/go-ethereum/pull/33748 Same issue - ResettingTimer can be registered via loadOrRegister() but GetAll() silently drops it during JSON export. The prometheus exporter handles it fine (collector.go:70), so this is just an oversight in the JSON path. Note: ResettingTimer.Snapshot() resets the timer by design, which is consistent with how the prometheus exporter uses it. Co-authored-by: vickkkkkyy --- metrics/registry.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/metrics/registry.go b/metrics/registry.go index f6de51bba1..b794c96357 100644 --- a/metrics/registry.go +++ b/metrics/registry.go @@ -186,6 +186,18 @@ func (r *StandardRegistry) GetAll() map[string]map[string]interface{} { values["5m.rate"] = t.Rate5() values["15m.rate"] = t.Rate15() values["mean.rate"] = t.RateMean() + case *ResettingTimer: + t := metric.Snapshot() + ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) + values["count"] = t.Count() + values["min"] = t.Min() + values["max"] = t.Max() + values["mean"] = t.Mean() + values["median"] = ps[0] + values["75%"] = ps[1] + values["95%"] = ps[2] + values["99%"] = ps[3] + values["99.9%"] = ps[4] } data[name] = values })