@@ -5,6 +5,9 @@ weight: 3
55
66The [ Pushgateway] ( https://github.com/prometheus/pushgateway )
77allows ephemeral and batch jobs to expose their metrics to Prometheus.
8+ Since Prometheus may not be able to scrape such a target, the targets can
9+ push their metrics to a separate instance of the Pushgateway,
10+ which then exposes these metrics to Prometheus.
811
912``` python
1013from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
@@ -18,16 +21,20 @@ push_to_gateway('localhost:9091', job='batchA', registry=registry)
1821A separate registry is used, as the default registry may contain other metrics
1922such as those from the Process Collector.
2023
21- Pushgateway functions take a grouping key. ` push_to_gateway ` replaces metrics
22- with the same grouping key, ` pushadd_to_gateway ` only replaces metrics with the
23- same name and grouping key and ` delete_from_gateway ` deletes metrics with the
24- given job and grouping key. See the
24+ Pushgateway functions take a grouping key.
25+ 1 . ` push_to_gateway ` replaces metrics
26+ with the same grouping key.
27+ 2 . ` pushadd_to_gateway ` only replaces metrics with the
28+ same name and grouping key.
29+ 3 . ` delete_from_gateway ` deletes metrics with the
30+ given job and grouping key.
31+ 4 . ` instance_ip_grouping_key ` returns a grouping key with the instance label set
32+ to the host's IP address.
33+
34+ See the
2535[ Pushgateway documentation] ( https://github.com/prometheus/pushgateway/blob/master/README.md )
2636for more information.
2737
28- ` instance_ip_grouping_key ` returns a grouping key with the instance label set
29- to the host's IP address.
30-
3138# Handlers for authentication
3239
3340If the push gateway you are connecting to is protected with HTTP Basic Auth,
0 commit comments