fix(rpc): use ResettingTimer for RPC duration metrics

The rpc/duration/all metric was using metrics.NewRegisteredTimer which
accumulates samples over the entire process lifetime. When exported to
Prometheus, quantile values grow to millions of seconds (displayed as years).

Switch to NewRegisteredResettingTimer which resets its sample buffer on
each Prometheus scrape, ensuring quantile calculations use recent data only.
This commit is contained in:
Dan Bryan 2025-12-16 19:29:45 -05:00
parent 9a3ffad54d
commit bbad7fc0f3
No known key found for this signature in database

View file

@ -31,7 +31,7 @@ var (
// serveTimeHistName is the prefix of the per-request serving time histograms.
serveTimeHistName = "rpc/duration"
rpcServingTimer = metrics.NewRegisteredTimer("rpc/duration/all", nil)
rpcServingTimer = metrics.NewRegisteredResettingTimer("rpc/duration/all", nil)
)
// updateServeTimeHistogram tracks the serving time of a remote RPC call.