@@ -5,6 +5,9 @@ weight: 3
5
5
6
6
The [ Pushgateway] ( https://github.com/prometheus/pushgateway )
7
7
allows 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, which then
10
+ exposes these metrics to Prometheus.
8
11
9
12
``` python
10
13
from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
@@ -18,10 +21,14 @@ push_to_gateway('localhost:9091', job='batchA', registry=registry)
18
21
A separate registry is used, as the default registry may contain other metrics
19
22
such as those from the Process Collector.
20
23
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
+ See the
25
32
[ Pushgateway documentation] ( https://github.com/prometheus/pushgateway/blob/master/README.md )
26
33
for more information.
27
34
0 commit comments