Skip to main content
The gateway exposes a /metrics endpoint scrapable by any standard Prometheus setup. This cookbook is a drop-in set of alert rules that cover what you actually need to page on: provider outages, budget bypass, auth cache degradation, streaming bugs, and cost anomalies. Copy this into alerts/langwatch-gateway.yml and prometheus reload or kubectl rollout restart your Prometheus Operator-managed PrometheusRule CR.

The ruleset

Why these and not others

The temptation with Prometheus rules is to alert on everything. Don’t. Each rule above either:
  • Represents real impact (5xx rate, circuit open, usage missing), customers or budgets are actively affected.
  • Is a leading indicator of incoming impact (excessive fallback, L1 cache drop, stale bundle), things get worse soon if ignored.
  • Is a cost guardrail (streaming usage missing, cost anomaly), silent over-spend is a real failure mode for AI infra.
Rules we explicitly do NOT have:
  • Individual provider 429s: these are normal operating state; fallback + circuit handle them without a human.
  • High latency: the gateway’s added latency is bounded; if a provider is slow, alerting on it is alerting on the provider.
  • Cache miss rate on upstream: cache is passthrough; if Anthropic doesn’t hit cache that’s not the gateway’s problem.

Slack, PagerDuty routing

Route severity: page to PagerDuty, severity: warn to Slack. Example Alertmanager config:

Verifying rules before deploy

Example unit test:

Grafana dashboard

A matching Grafana dashboard JSON is at /ai-gateway/self-hosting/helm#monitoring. Panels mirror the alert rules so you can visually see what’s about to fire.

See also

  • Troubleshooting: paged-at-3am runbook for each symptom.
  • Observability: span attributes + metric names surface.
  • Streaming: the include_usage gotcha these alerts catch.
  • Budgets: how spend reaches the ledger and what the precheck can see.