Observability · Prometheus
Recording Rules
Cheat sheet · https://pcornel.dk/topic.php?topic=6217
Answer
Recording rules precompute expensive PromQL expressions into new series at each evaluation, speeding up dashboards and alerts.
Remember
Name as level:metric:operations (e.g. job:http_requests:rate5m). Validate with promtool. Rules evaluate per group interval.
First checks
promtool check rules rules.yml— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool check config prometheus.yml— config valid
Verify in this order
expression → rule group evaluation → new series → queries
Where it usually breaks
Changing a recording rule breaks dashboards that use the old name.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6217