gitsrht_periodic: don't overwrite metrics group

Currently, gitsrht_periodic pushes metrics to the pushgateway using only
job="git.sr.ht" as a grouping key. This will overwrite _any_ metrics
that have been pushed using the same key. This includes for example the
certificate expiration.

A discussion could be had about using more specific grouping keys for
the various different jobs, but for now I think it is most sensible to
simply use `_pushadd` instead of `_push` to preserve other metrics
pushed with the same key by other jobs. This is also the behavior when
using a plain `curl` to push data, as curl will default to POST. The
`_push` method behavior is that of PUT request instead.

Here is the relevant section of the Python client README:

https://github.com/prometheus/client_python#exporting-to-a-pushgateway

And here is more detailed explanation of the POST vs. PUT semantics:

https://github.com/prometheus/pushgateway#api
This commit is contained in:
Conrad Hoffmann 2023-05-30 15:20:50 +02:00 committed by Drew DeVault
parent 7fb5c45da8
commit a39556963c
1 changed files with 1 additions and 1 deletions

View File

@ -106,5 +106,5 @@ all()
pg_endpoint = cfg("sr.ht", "pushgateway", default=None)
if pg_endpoint:
prometheus_client.push_to_gateway(pg_endpoint,
prometheus_client.pushadd_to_gateway(pg_endpoint,
job="git.sr.ht", registry=registry)