prometheus-cpp
prometheus-cpp copied to clipboard
Expiring Metrics
Some other prometheus exporters expire metrics. For example:
https://github.com/prometheus/statsd_exporter#time-series-expiration https://github.com/prometheus/statsd_exporter/blob/master/exporter.go#L447
We'd like to see support for this in prometheus-cpp and would be happy to add it. Any guidance around going about integrating it? Thanks!
This is not something that client libraries should generally provide, a child should in principle have the same lifecycle as the process.
@brian-brazil we picked this functionality up with statsd_exporter
and are continuing to use it directly in this library - checkout our branch if you're interested in this functionality: https://github.com/jupp0r/prometheus-cpp/compare/master...swift-nav:master.
Thanks for chiming in @brian-brazil. My general understanding is that dynamically creating and removing metrics is discouraged because the prometheus servers data model assumes the number of metrics to be constant per scrape target. Has that changed in 2.x?
Discouraged yes, however dynamically creating is fairly standard (if abused at times).
Would someone be able to elaborate on why this practice is discouraged? Thanks!
PS. For our application, we have metrics that are labelled with phases. Our process progresses from one phase to the next and never revisits the previous phases. So, expiring these metrics would get us some savings.
This would be very useful.