prometheus / prometheus/prometheus

Remove instances of `prometheus.DefaultRegisterer`

Open
#15,725 1 comment 0 reactions 1 assignee View on GitHub

@Vandit1604 is already working on this.

Since Jan 14, 2025.

kind/enhancement priority/P3
Dominant language
Go
Stars
66.1k
Forks
10.8k
Avg merge
2d 1h
Merged PRs (30d)
131

Description

Proposal

Following #12549, the scrape and discovery packages no longer require use of the default registerer. However, prometheus.DefaultRegisterer is still used in the codebase, particularly in main.go. It would be good to replace this with a single prometheus.NewRegistry().

This would have a few advantages:

  • We are closing a loophole where a new feature could still use prometheus.DefaultRegisterer outside of main.go.
  • It's a signal that prometheus.DefaultRegisterer is no longer required.

While I think that scrape and discovery packages would work well with a non-default registry, there could be other packages which still rely on the default resiterer. We would need to take extra care when doing this change:

  1. Browse the codebase for code which registers metrics in the default registry
  2. Run a Prometheus instance which uses these bits of code.
  3. Reload the config of that Prometheus instance to make sure there are no errors due to double registration.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.