push_to_gateway {openmetrics}R Documentation

Pushgateway Integration

Description

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.

Usage

push_to_gateway(url, job, instance = NA, registry = global_registry(), ...)

delete_from_gateway(url, job, instance = NA, ...)

Arguments

url

The URL of the Pushgateway

job

A value for the job label applied to all pushed metrics.

instance

A value for the instance label applied to all pushed metrics, or NA to leave it unset.

registry

A Registry object, defaulting to the shared global one.

...

Additional named string arguments converted to labels. Beware that these are not yet checked for URL safety.

Value

NULL, invisibly.

Examples

## 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)


[Package openmetrics version 0.3.0 Index]