hashicorp / go-metrics

A Golang library for exporting performance and runtime metrics to external metrics systems (i.e. statsite, statsd)
MIT License
1.46k stars 177 forks source link

Refactor Shutdown into a separate interface to revert breaking change. #135

Closed banks closed 2 years ago

banks commented 2 years ago

132 Added a new Shutdown method that solves a specific problem with short-lived processes.

Unfortunately since it added a new method to a public interface it broke backwards compatibility for other users of this library. We retracted the release v0.3.11 in #134.

Technically this library is still "zerover" since it's not yet made it to the 1.0.0 milestone and likely never will, but it is used widely in HashiCorp tools so it's preferable not to break downstream builds!

This PR moves the new Shutdown method into a separate interface that can be optionally implemented by Sinks. I also remove all the no-op implementations for built-in Sinks since they are not longer necessary.

@ggambetti would love to know if this will cause any issues for you? I think it should be compatible and tests all pass as before.