faust.web.apps.metrics

HTTP endpoint exposing performance metrics.

Enabled with the web_metrics_enabled setting, which is off by default:

app = faust.App("myapp", web_metrics_enabled=True)

Unlike the statistics endpoints in faust.web.apps.stats this is independent of debug, so it can be left on in production.

The payload is grouped by concern rather than being a flat dump of Monitor.asdict(), and adds two things that monitor does not compute:

  • consumer lag – derived from the log end offsets and the offsets this worker has actually read, which is the number you usually want to alert on.

  • latency percentiles – monitor keeps raw deques of up to a few thousand samples; those are summarized here instead of serialized.

faust.sensors.prometheus serves the same underlying data in Prometheus format on its own path; the two are independent.

class faust.web.apps.metrics.Metrics(app: AppT, web: Web)[source]

— description: Worker performance metrics. tags: - Faust produces: - application/json

async get(request: Request) Response[source]

Return JSON response with performance metrics.

Return type:

Response

metrics() Mapping[str, Any][source]

Build the metrics payload.

Return type:

_GenericAlias[str, Any]