Skip to content

Bulk push to pushgateway #746

Answered by csmarchbanks
niteshsin786 asked this question in Q&A
Discussion options

You must be logged in to vote

You can see the example in the README for pushing to a gateway: https://github.com/prometheus/client_python#exporting-to-a-pushgateway.

In your case the code would look something like:

from prometheus_client import CollectorRegistry, Gauge, push_to_gateway

registry = CollectorRegistry()
g = Gauge('test', 'test metric', ['id'], registry=registry)
g.labels("11137241").set(3.2)
...
push_to_gateway('localhost:9091', job='pushgateway', registry=registry)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by niteshsin786
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants