Prometheus#

Collect metrics based on prometheus.

class blacksmith.middleware._async.prometheus.AsyncPrometheusMiddleware(metrics: Optional[blacksmith.domain.model.middleware.prometheus.PrometheusMetrics] = None)#

Collect the api calls made in a prometheus registry.

It expose a blacksmith_info Gauge to get the blacksmith version, as a label, and a blacksmith_request_latency_seconds_count Counter to get the number of http requests made. The counter blacksmith_request_latency_seconds_count as client_name, method, path and status_code labels.

Note

the service_name and service version is redundant with the client_name, so they are not exposed as labels. By the way, you may have multiple client_name for 1 service name/version.

metrics: blacksmith.domain.model.middleware.prometheus.PrometheusMetrics#
__call__(next: blacksmith.domain.typing.AsyncMiddleware) blacksmith.domain.typing.AsyncMiddleware#

Call self as a function.