rcrowley / go-metrics

Go port of Coda Hale's Metrics library
Other
3.43k stars 493 forks source link

EWMA and Sample fix in register() and MarshalJSON() #202

Closed ioj closed 7 years ago

ioj commented 7 years ago

This PR aims to fix three things:

1) StandardRegistry.register() checks whether the passed argument is a valid measuring instrument. However, Sample and EWMA were missing from the list.

2) StandardRegistry.register() silently ignored incompatible arguments instead of returning an error, which could make things harder to debug. A fix introduces a new UnknownMetric error which is returned by the method if an invalid argument is passed.

3) Adds missing Sample and EWMA marshalling in StandardRegistry.MarshalJSON().