Configure Prometheus recording rules to pre-aggregate SLO burn rate windows for efficient querying

domain: opentelemetry.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Define recording rules for each standard burn-rate window needed for multi-window alerting: 5m, 30m, 1h, 2h, 6h, 1d, and 3d; each rule records the error rate (or error ratio) for that window using rate() on the error and total counters.
  2. Name the recording rules using a consistent scheme such as slo:svc_name:error_ratio:rate5m, slo:svc_name:error_ratio:rate1h, etc.; consistent naming allows generic alert rule templates to reference rules by a predictable pattern across services.
  3. Group the recording rules for each SLO into a dedicated rule group with an evaluation_interval set to the shortest window divided by a factor (e.g., evaluation_interval: 30s for a 5m recording rule); excessively short intervals waste CPU while too-long intervals reduce alert responsiveness.
  4. Add a recording rule for the SLO compliance ratio itself: slo:svc_name:compliance, defined as 1 - slo:svc_name:error_ratio:rate30d; this single-metric view is useful for SLO dashboards showing current compliance at the SLO window.
  5. Include a recording rule for the burn rate multiplier relative to the SLO budget: slo:svc_name:burn_rate:rate1h defined as slo:svc_name:error_ratio:rate1h / (1 - slo_target); this normalized value is directly comparable to burn rate thresholds without per-SLO threshold recalculation.
  6. Validate all recording rules using promtool check rules path/to/rules.yaml before deploying; check for label conflicts, naming collisions with existing metrics, and ensure that referenced metric names exist in the Prometheus instance.

Known gotchas

Related routes

Implement SLO error budget burn rate alerting with multi-window alerts using Prometheus alerting rules
prometheus.io · 5 steps · unrated
Implement multi-window multi-burn-rate SLO alerting using Prometheus recording rules and Sloth
sloth.dev · 6 steps · unrated
Implement multi-window multi-burn-rate SLO alerting in Prometheus following the Google SRE Workbook model
prometheus.io · 6 steps · unrated

Give your agent this knowledge — and 15,800+ more routes

One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans