Scrape Prometheus metrics
Requires an authenticated employee session — this exposes cross-tenant operational data (per-tenant job counts/durations, LLM token usage), gated by employee auth alone (a Prometheus scrape is not logged as a per-request user action, so it does not write an audit-log row). Computes gauges fresh from PostgreSQL on every scrape rather than accumulating in-process, so results stay correct across multiple API replicas: platform job counts/durations by type and status, tenant counts by lifecycle state, per-tenant ingest job counts, per-tenant LLM token usage this month, and pending job queue depth. A single tenant’s metrics query failing is swallowed so it does not blank the whole scrape. Implemented in services/api/metrics_api.py.
Response
Successful Response