Impossible removal of observed metrics, resource leaks
mixalturek opened this issue · 1 comments
mixalturek commented
Re-registration of a new metric under already used name lets all of them active. If a metric is registered periodically or on an recurring action this behavior will result in kinda resource leak. Metrics that are once added can't be removed nor unregistered, the API doesn't support that.
Code to reproduce, using dipstick/examples/observer.rs
:
metrics.observe(metrics.gauge("uptime"), |_| 5).on_flush();
metrics.observe(metrics.gauge("uptime"), |_| 3).on_flush();
metrics.observe(metrics.gauge("uptime"), |_| 10).on_flush();
Value 6 that has never existed and that is based on average is then reported forever.
process.heartbeat 1
process.threads 4
process.uptime 6
process.heartbeat 1
process.threads 4
process.uptime 6
process.heartbeat 1
process.threads 4
process.uptime 6
...
I prefer a behavior similar to this one - replace the existing metric by a new one.
5e35e68
fralalonde commented
Please have a look at #66