Gauge to track the current number of metrics known [was: metricsCount metric remain the same after metric been deleted by RemoveStaleMetrics]
I was using https://github.com/prometheus/statsd_exporter/blob/58769c7b4d128e7ceae1cf8d893260ed5b5afa4d/main.go#L167-L173 to track the metric number of statsd exporter, but found that this metric never drops, even if I set the ttl parameter in config file.
Then I noticed, across all the reference of the metrics, these's no place to decrease the gauge.
even in the https://github.com/prometheus/statsd_exporter/blob/58769c7b4d128e7ceae1cf8d893260ed5b5afa4d/pkg/registry/registry.go#L381-L396
So I think if we add a decrease in this function, the metric number would show the real number of metric number
This is a counter, it represents the total number of metrics seen by the exporter, and by definition counters cannot decrease. I think what you are looking for is a metric for the current number of metrics the exporter knows about, which would have to be a separate gauge. Let's call it statsd_exporter_metrics_current or something? I'm happy to take a contribution to add that.
The metric name looks good to me, thanks for your contribution in advance!
@matthiasr Isn't that already captured by scrape_samples_scraped and scrape_samples_post_metric_relabeling?
@SuperQ the original metric statsd_exporter_metrics_total provides separated counters for each metric type, including counter, gauge, and observer, this could be useful