From 7f0726f70631842cab4af188903d82f79fa37ba0 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Mon, 11 Jun 2018 10:31:55 +0300 Subject: [PATCH] metrics: return an empty snapshot for NilResettingTimer (#16930) --- metrics/resetting_timer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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()) {}