diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-06-11 15:31:55 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-06-11 15:31:55 +0800 |
commit | 7f0726f70631842cab4af188903d82f79fa37ba0 (patch) | |
tree | f86060e9a20bc010da137421cb23c06b2e53e569 /metrics | |
parent | 13af27641829f61d1e6b383e37aab6caae22f2c1 (diff) | |
download | dexon-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.go | 6 |
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()) {} |