Description Usage Arguments Value Examples
Some workloads may not want to run an HTTP server to expose metrics, especially in the case of short-lived batch jobs. For these cases metrics can also be manually "pushed" to a Prometheus Pushgateway instance, though there are drawbacks.
push_to_gateway()
is used to push metrics, and delete_from_gateway()
is
used to clean them up when the workload is finished.
1 2 3 4 5 6 7 8 9 10 11 | push_to_gateway(
url,
job,
instance = NA,
registry = global_registry(),
...,
retry_times = 3,
httr_config = list()
)
delete_from_gateway(url, job, instance = NA, ...)
|
url |
The URL of the Pushgateway |
job |
A value for the |
instance |
A value for the |
registry |
A |
... |
Additional named string arguments converted to labels. Beware that these are not yet checked for URL safety. |
retry_times |
Number of times to (re)try the request if it fails. Passed
to |
httr_config |
Additional request configuration (such as timeouts or SSL
options) passed to |
NULL
, invisibly.
1 2 3 4 5 6 7 | ## Not run:
register_default_metrics()
push_to_gateway("localhost:9091", job = "batch-job-1")
# Some time later...
delete_from_gateway("localhost:9091", job = "batch-job-1")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.