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().
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().