Prometheus exposition endpoint
GET /api/metrics/prometheus
Returns Prometheus text/plain exposition (version 0.0.4) covering platform-health metrics: build info, default Go runtime + process collectors, ClickHouse health/error/insert-latency, alarm engine tick age and state-transition counts, notification delivery counts and queue depth, Vector circuit breaker state.
Authentication uses a dedicated scrape token issued from
POST /api/integrations/prometheus-tokens. The token format is
dpiprom_<base64url-32-bytes> and is passed as a bearer in the
Authorization header. Scrape tokens are NOT JWTs — they only
authenticate THIS route. Using a scrape token on any other API
endpoint returns 401 because the regular AuthMiddleware (JWT
parser) rejects it (D-13 / AUTH-03).
The endpoint is only mounted when prometheus.enabled: true is set
in the YAML config (D-40). When disabled the route returns 404.
Per-traffic-data labels are forbidden by construction — a Go golden-output test (SC-6) enforces the metric-name allowlist and label-key denylist at build time.
Authorizations
Section titled “Authorizations ”Responses
Section titled “ Responses ”Prometheus exposition. One metric family per # HELP / # TYPE
block; metric lines follow text/plain exposition v0.0.4 syntax.
Parseable by promtool check metrics and by any standard
Prometheus scrape config.
Example
# HELP dhcp_dpi_build_info A gauge with labeled build metadata; value is always 1.# TYPE dhcp_dpi_build_info gaugedhcp_dpi_build_info{commit="b120f7f5",go_version="go1.23.10",version="1.20.0"} 1# HELP dhcp_dpi_alarms_active Current active alarm count by severity.# TYPE dhcp_dpi_alarms_active gaugedhcp_dpi_alarms_active{severity="critical"} 0dhcp_dpi_alarms_active{severity="warning"} 2# HELP dhcp_dpi_clickhouse_up 1 if ClickHouse responded within the staleness window, else 0.# TYPE dhcp_dpi_clickhouse_up gaugedhcp_dpi_clickhouse_up{instance="appliance-host"} 1# HELP dhcp_dpi_notifications_delivered_total Total notifications dispatched, labelled by channel and delivery result.# TYPE dhcp_dpi_notifications_delivered_total counterdhcp_dpi_notifications_delivered_total{channel="vector",result="ok"} 42Missing or invalid scrape token. Body is a single Prometheus comment line (text/plain version=0.0.4) so the response is still well-formed for tooling — NOT a JSON error envelope (AUTH-02 / D-15).
Example
# Unauthorized: missing or invalid scrape token