aioprometheus.pusher module

class aioprometheus.pusher.Pusher(job_name: str, addr: str, grouping_key: Optional[dict] = None, path: str = '/metrics')

Bases: object

This class can be used in applications that can’t support the standard pull strategy. The pusher object pushes the metrics to a push-gateway which can be scraped by Prometheus.

PROMETHEUS_PATH = '/metrics'
async add(registry: aioprometheus.collectors.Registry = <aioprometheus.collectors.Registry object>) aiohttp.client_reqrep.ClientResponse

add works like replace, but only metrics with the same name as the newly pushed metrics are replaced.

async delete(registry: aioprometheus.collectors.Registry = <aioprometheus.collectors.Registry object>) aiohttp.client_reqrep.ClientResponse

delete deletes metrics from the push gateway. All metrics with the grouping key specified in the URL are deleted.

async replace(registry: aioprometheus.collectors.Registry = <aioprometheus.collectors.Registry object>) aiohttp.client_reqrep.ClientResponse

replace pushes new values for a group of metrics to the push gateway.

Note

All existing metrics with the same grouping key specified in the URL will be replaced with the new metrics value.