recording rule
also: Prometheus recording rule
A Prometheus configuration that defines how to aggregate time-series metrics into new metrics at regular intervals. Recording rules precompute expensive queries to improve performance and reduce load on the monitoring system.
Recording rules are part of Prometheus's evaluation engine, allowing you to periodically execute a metric query and store the result as a new time-series metric. This precomputation improves dashboard responsiveness and reduces the computational burden of frequent, complex queries.
Rules are defined in YAML configuration files with a name, interval, and PromQL expression. For example, a rule might compute the average request latency every 30 seconds: avg(rate(http_request_duration_seconds_sum[5m]) / rate(http_request_duration_seconds_count[5m])), storing the result as job:http_request_latency:avg5m.
Unlike alert rules (which trigger notifications), recording rules purely create new queryable metrics. They're essential for scaling Prometheus deployments and simplifying complex metric hierarchies.