Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove init() from discovery/metrics.go #13788

Closed
bjschafer opened this issue Mar 18, 2024 · 1 comment
Closed

Remove init() from discovery/metrics.go #13788

bjschafer opened this issue Mar 18, 2024 · 1 comment

Comments

@bjschafer
Copy link

What did you do?

Imported github.com/prometheus/prometheus/model/rulefmt to perform rule validation, in a project that's also using k8s.io/client-go and expects to register its own workqueue metrics.

Instead, because of a dependency chain, github.com/prometheus/prometheus/discovery ends up imported, and because it has an init() function which registers these metrics, it overwrites the metrics I'm using.

What did you expect to see?

Valid e.g. workqueue_depth metrics from my controller.

What did you see instead? Under which circumstances?

No e.g. workqueue_depth metrics from my controller, as they get stomped on by the discovery package.

System information

No response

Prometheus version

No response

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

@bboreham
Copy link
Member

Prometheus is not designed for use as a library. Any difficulties you have using it as such are not an issue for Prometheus.

You are welcome to propose a PR which makes things easier for you, but I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants