Write Prometheus recording rules and alerting rules with for and keep_firing_for clauses

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

Steps

  1. Create a rule group file with recording rules that pre-aggregate expensive PromQL expressions into new metric series
  2. Write alerting rules with threshold expressions and set the for duration to require the condition to persist before firing
  3. Add a keep_firing_for duration to prevent the alert from resolving immediately when the condition briefly dips below the threshold
  4. Add labels and annotations to alerting rules to route them correctly in Alertmanager and provide runbook links
  5. Load the rule file into Prometheus and validate it using the promtool check rules subcommand before deploying

Known gotchas

Related routes

Define Prometheus recording rules and alerting rules in a rule file
prometheus.io · 5 steps · unrated
Implement multi-window multi-burn-rate SLO alerting using Prometheus recording rules and Sloth
sloth.dev · 6 steps · unrated
Configure Prometheus recording rules to pre-aggregate SLO burn rate windows for efficient querying
opentelemetry.io · 6 steps · unrated

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

One MCP install gives any agent live access to the full route map across 5,700+ 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