rcrowley / go-metrics

Go port of Coda Hale's Metrics library
Other
3.46k stars 494 forks source link

Stopping metrics reporters #110

Closed imkira closed 9 years ago

imkira commented 9 years ago

Is there any reason why there is no official way of stopping a reporter once you have called its reporting function?

Example (Log reporter):

https://github.com/rcrowley/go-metrics/blob/master/log.go#L10

In order to be more test-friendly and to be able to gracefully stop metric reporting it would be cool to have such feature. I could try working on a PR for this. What do you think?

tsenart commented 9 years ago

+1

On Tuesday, March 24, 2015, Mário Freitas notifications@github.com wrote:

Is there any reason why there is no official way of stopping a reporter once you have called its reporting function?

Example (Log reporter):

https://github.com/rcrowley/go-metrics/blob/master/log.go#L10

In order to be more test-friendly and to be able to gracefully stop metric reporting it would be cool to have such feature. I could try working on a PR for this. What do you think?

— Reply to this email directly or view it on GitHub https://github.com/rcrowley/go-metrics/issues/110.

Sent from Gmail Mobile

mihasya commented 9 years ago

I'd happily review a PR, but I'm not 100% sure it's worth the effort - reporting is usually not a critical component of the application, and all resources associated with it get released when the process exits. It would have to be an extremely clean, low impact patch where existing implementations such as the logger could remain very simple.

I think @rcrowley originally avoided introducing a special reporter interface because they all have subtly different needs. It may make even less sense as I start to enforce this policy

mihasya commented 9 years ago

Closing until there's a PR to discuss. Thanks!