API reference¶
- class nameko_prometheus.dependencies.MetricsServer[source]¶
Serves metrics in a format readable by Prometheus scraper.
Call
expose_metrics()
from a service method decorated with @http entrypoint to present metrics to Prometheus over HTTP.
- class nameko_prometheus.dependencies.PrometheusMetrics(*args, **kwargs)[source]¶
Dependency provider which measures RPC, event handler and HTTP endpoint latency.
On service start, a few default metrics are declared. These are:
<prefix>_http_requests_total
<prefix>_http_request_latency_seconds
<prefix>_rpc_requests_total
<prefix>_rpc_request_latency_seconds
<prefix>_events_total
<prefix>_events_latency_seconds
<prefix>_timer_total
<prefix>_timer_latency_seconds
<prefix>_consumer_total
<prefix>_consumer_latency_seconds
where
prefix
is either derived fromname
attribute of the service class, or configured manually.- get_dependency(worker_ctx: nameko.containers.WorkerContext) nameko_prometheus.dependencies.MetricsServer [source]¶
Returns an instance of
MetricsServer
to be injected into the worker.