go-metrics icon indicating copy to clipboard operation
go-metrics copied to clipboard

Add Clear to Meter and Timer

Open henning77 opened this issue 9 years ago • 7 comments

I needed Clear() on both Meter and Timer to reset these after a unit test. Counter, Histogram, Sample already have Clear so I added equivalent methods.

henning77 avatar Apr 03 '15 21:04 henning77

+1 Can we get this merged?

freeformz avatar Jun 04 '15 21:06 freeformz

+1 as this should resolve #120

FZambia avatar Jul 04 '15 08:07 FZambia

(starting to try and catch up on the backlog)

I am reluctant to accept a change which extends an interface, then immediately proceeds to add implementations which panic to half of the implementations.

Could the method just be added to the implementation you're testing and left out of the interface?

mihasya avatar Jul 04 '15 19:07 mihasya

@FZambia I'll comment in the ticket itself, but I wanted to make it clear here too: nothing you've described in #120 sounds like a bug to me.

mihasya avatar Jul 04 '15 19:07 mihasya

Bump, @henning77 can you weigh in on the question from July 4th? Thanks!

mihasya avatar Nov 29 '15 22:11 mihasya

@mihasya Clear() panics when called on the snapshot. Which is reasonable and in line with the other Clear() implementations, e.g. in https://github.com/rcrowley/go-metrics/blob/master/histogram.go

henning77 avatar Feb 18 '16 09:02 henning77

+1 Can we get this merged? Seems to be reasonable.

yalay avatar Sep 02 '16 10:09 yalay