Prometheus metrics
Air Pipe exposes a Prometheus /metrics endpoint and lets actions emit custom
metrics. For distributed tracing see OpenTelemetry tracing.
Managed configs don't serve /metrics. Their request, error and latency metrics are collected
and stored for you: see Hosted metrics.
Enable it
Set expose_metrics: true at the config root. /metrics is served in self-hosted
modes and is unauthenticated (Prometheus convention — isolate it by network).
name: my-api
expose_metrics: true
interfaces:
# ...
As of engine 1.7.2, /metrics is served on a dedicated bind, default
127.0.0.1:9090 — not the public API port — so it isn't exposed alongside your
API. Configure with --metrics-address (env AIRPIPE__METRICS_BIND):
| Value | Effect |
|---|---|
127.0.0.1:9090 (default) | loopback — scrape locally or via a sidecar |
0.0.0.0:9090 | all interfaces — firewall the port |
off | disable the endpoint (and the per-request instrumentation) |
(Before 1.7.2, /metrics was served on the API port.)
Scrape config:
scrape_configs:
- job_name: airpipe
static_configs:
# engine >= 1.7.2: the dedicated metrics bind (default 127.0.0.1:9090).
# If Prometheus runs elsewhere, start AirPipe with --metrics-address 0.0.0.0:9090.
- targets: ["127.0.0.1:9090"]
Built-in metrics
| Metric | Type | Labels |
|---|---|---|
airpipe_interface_requests_total | counter | config, interface |
airpipe_interface_duration_ms | summary | config, interface, quantile |
airpipe_http_action_duration_ms | summary | config, interface, action, status, quantile |
axum_http_requests_total | counter | endpoint, method, status |
axum_http_requests_duration_seconds | histogram | endpoint, method, status, le |
axum_http_requests_pending | gauge | endpoint, method |
- Per-route numbers come from the
airpipe_*series, labelled byinterface. Theaxum_*series see every config route as oneendpoint,/{*catchall}, so use them for totals, status codes and overall latency. - The two
_msseries are summaries: quantiles (0,0.5,0.9,0.95,0.99,0.999,1) over roughly the last minute, plus_sumand_count. Read a quantile directly, for exampleairpipe_interface_duration_ms{quantile="0.95"}, rather than withhistogram_quantile. Summaries from several engines can't be combined into one quantile, so chart them per engine.
Custom metrics
Emit your own metrics from an action with emit_metric. Full fields:
EmitMetric reference.
actions:
- name: RecordSignup
emit_metric:
name: signups_total # must be a valid Prometheus metric name
type: counter # counter (default) | gauge | histogram
value: 1
labels:
plan: a|body::plan|
- counter — increments by
1whenvalueis omitted. - gauge / histogram — require a
value. - Air Pipe auto-attaches
config,interfaceandactionlabels to every custom metric, in addition to anylabelsyou set.