aboutsummaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2018-06-11 15:31:55 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-06-11 15:31:55 +0800
commit7f0726f70631842cab4af188903d82f79fa37ba0 (patch)
treef86060e9a20bc010da137421cb23c06b2e53e569 /metrics
parent13af27641829f61d1e6b383e37aab6caae22f2c1 (diff)
downloaddexon-7f0726f70631842cab4af188903d82f79fa37ba0.tar
dexon-7f0726f70631842cab4af188903d82f79fa37ba0.tar.gz
dexon-7f0726f70631842cab4af188903d82f79fa37ba0.tar.bz2
dexon-7f0726f70631842cab4af188903d82f79fa37ba0.tar.lz
dexon-7f0726f70631842cab4af188903d82f79fa37ba0.tar.xz
dexon-7f0726f70631842cab4af188903d82f79fa37ba0.tar.zst
dexon-7f0726f70631842cab4af188903d82f79fa37ba0.zip
metrics: return an empty snapshot for NilResettingTimer (#16930)
Diffstat (limited to 'metrics')
-rw-r--r--metrics/resetting_timer.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/metrics/resetting_timer.go b/metrics/resetting_timer.go
index f33a9f8aa..e5327d3bd 100644
--- a/metrics/resetting_timer.go
+++ b/metrics/resetting_timer.go
@@ -58,7 +58,11 @@ type NilResettingTimer struct {
func (NilResettingTimer) Values() []int64 { return nil }
// Snapshot is a no-op.
-func (NilResettingTimer) Snapshot() ResettingTimer { return NilResettingTimer{} }
+func (NilResettingTimer) Snapshot() ResettingTimer {
+ return &ResettingTimerSnapshot{
+ values: []int64{},
+ }
+}
// Time is a no-op.
func (NilResettingTimer) Time(func()) {}