go-metrics
go-metrics copied to clipboard
Allow to set samples rescale threshold
Global function to set and get global rescale threshold for exponentially decaying samples, which construction is hidden by default metrics constructors.
@rcrowley PR doesn't includes tests, because I want to discuss the solution before finish the PR.
I think, the most robust solution will be change of the EDS structure and constructor to allow custom rescale threshold as the field and argument. But it will break the backward compatibility and grows up the complexity of the user code, which requires custom rescale threshold, because it avoids the ability to use Registry.GetOrRegisterTimer, for example. So my changes provides an easy way to set custom rescale threshold for a whole application, which covers my application requirements :)
First of all, I'm sorry for the delay. Second of all, I'm wondering what you think about just exporting RescaleThreshold as a number. If you set it in init or main before launching any goroutines it's perfectly safe and we'd avoid the read-write lock every time it rescales.
Plus, that wouldn't need tests. :)
@kaero thoughts on @rcrowley's last comment? Thanks!
Any progress here?