Prometheus

Collect metrics based on prometheus.

class blacksmith.middleware._async.prometheus.AsyncPrometheusMiddleware(metrics: PrometheusMetrics | None = 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: PrometheusMetrics
__call__(next: AsyncMiddleware) AsyncMiddleware

Call self as a function.