prometheus: Add CollectorRegistry.unregister functions - #55
Conversation
Sources of metrics can sometimes disappear at runtime (a VM being destroyed, disk being unplugged), and rather than continuing to present the last value, it is useful to remove them altogether. Other Prometheus client libraries do implement similar functions as well, see https://docs.rs/prometheus/latest/prometheus/struct.Registry.html#method.unregister for example. Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
…ily's metric Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
|
This looks good to me; I'll add it into my release queue unless anyone has any further thoughts (@talex5?) |
|
|
|
On that note, the prometheus spec recommends:
|
Sources of metrics can sometimes disappear at runtime (a VM being destroyed, disk being unplugged), and rather than continuing to present the last value, it is useful to remove them altogether.
Other Prometheus client libraries do implement similar functions as well, see https://docs.rs/prometheus/latest/prometheus/struct.Registry.html#method.unregister for example.