Gauge to track the current number of metrics known [was: metricsCount metric remain the same after metric been deleted by RemoveStaleMetrics]

Open Beginner friendly
#565 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go

Research direction

Start with the metric definition in main.go at lines 167-173 and the RemoveStaleMetrics function in pkg/registry/registry.go at lines 381-396. Trace how stale metrics are removed when the configured TTL expires, then verify that the gauge reflects the current number of known metrics after deletion.

Written by the indexing model from the issue text.

Description

enhancement help wanted

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

Dominant language
Go
Stars
987
Forks
259
Avg merge
22h 10m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prometheus/statsd_exporter

All issues in prometheus/statsd_exporter

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.