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

push metrics: Please expose functionality to get push url and encoded metrics (without push feature) #536

Open
aawsome opened this issue Feb 7, 2025 · 1 comment

Comments

@aawsome
Copy link

aawsome commented Feb 7, 2025

Is your feature request related to a problem? Please describe.
We would like to push metrics to a pushgateway. The push feature however is quite restricted to a special reqwest configuration which does not comply to our dependency situation

Describe the solution you'd like
Within the code in https://github.com/tikv/rust-prometheus/blob/master/src/push.rs#L80, most work involves creating the exact url to use and to create and validate the encoded metrics.
I wonder if we could simply refactor this in its own public function which is independent from the push feature, meaning which does not involve any external dependency.

Describe alternatives you've considered
There is the crate prometheus-push but is has its own compromises and pulls other dependencies.
An alternative would be to add similar functionality to this crate.

The solution I have currently chosen is to copy&paste the code into my own codebase.

@Ekleog
Copy link

Ekleog commented Feb 7, 2025

Just to suggest an alternative, also coming from the same place: I think if the push feature could require reqwest with default-features = false, it would also solve the issue.

This way, users who want it could add native-tls, while users who don't want to require libssl-dev could eg. enable rustls on reqwest.

WDYT?

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