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

Support PUT for clearing all existing metrics #11

Open
ltagliamonte opened this issue Jul 10, 2022 · 2 comments
Open

Support PUT for clearing all existing metrics #11

ltagliamonte opened this issue Jul 10, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@ltagliamonte
Copy link

All prometheus_client example uses push_to_gateway function to push metrics to the prometheus gateway.
https://github.com/prometheus/client_python#exporting-to-a-pushgateway

The push_to_gateway method uses PUT as http method: https://github.com/prometheus/client_python/blob/v0.14.1/prometheus_client/exposition.py#L448

meanwhile pushadd_to_gateway uses POST as HTTP method:
https://github.com/prometheus/client_python/blob/v0.14.1/prometheus_client/exposition.py#L479

would be nice to add support to PUT method as well so that developers can switch gateways with no code change.

@ltagliamonte ltagliamonte changed the title push_to_gateway method not supported [prometheus_client] push_to_gateway - method not supported Jul 10, 2022
@sinkingpoint
Copy link
Owner

Interesting. I've looked at a couple of client libraries around this, and it's a bit hit or miss as to what method is used, and what semantics get applied where. For now, I've just added PUT as an alias to POST, but perhaps we want to make it more like the above where it deletes the existing metrics? Similar to #8 maybe

@ltagliamonte-dd
Copy link

ltagliamonte-dd commented Jul 11, 2022

thanks for adding the support to PUT method.
I can see the use case for DELETE, especially if someone happens to push a bad metric and you don’t want to restart the proxy to get rid of that metric.
i would offer the DELETE method and as well a /reset endpoint to delete all metrics.

@sinkingpoint sinkingpoint changed the title [prometheus_client] push_to_gateway - method not supported Support PUT for clearing all existing metrics Sep 26, 2022
@sinkingpoint sinkingpoint added the enhancement New feature or request label Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants