@@ -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,
10
+ which then exposes these metrics to Prometheus.
8
11
9
12
``` python
10
13
from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
@@ -18,16 +21,20 @@ 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
+ 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
25
35
[ Pushgateway documentation] ( https://github.com/prometheus/pushgateway/blob/master/README.md )
26
36
for more information.
27
37
28
- ` instance_ip_grouping_key ` returns a grouping key with the instance label set
29
- to the host's IP address.
30
-
31
38
# Handlers for authentication
32
39
33
40
If the push gateway you are connecting to is protected with HTTP Basic Auth,
0 commit comments