Menu
Grafana Cloud Enterprise Open source RSS

Configure recording rules

Recording rules allows you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.

For instance, you can create a recording rule generating a new metric, error_9001_count, which counts occurrences of a specific log error within one minute. Then, query the error_9001_count metric in dashboards and alert rules.

Recording rules can be helpful in various scenarios, such as:

  • Faster queries are needed: Performing heavy aggregations or querying large data sets is quicker with precomputed results than real-time queries.
  • Reducing system load: Precomputing specific queries in advance can reduce system overload caused by multiple simultaneous queries.
  • Simplifying complex aggregations: Create a new metric from complex aggregations to facilitate alert and dashboard setup.
  • Reusing queries across alerts: Improve efficiency by reusing the same query across similar alert rules and dashboards.

The evaluation group of the recording rule determines how often the metric is pre-computed.

Similar to alert rules, Grafana supports two types of recording rules:

  1. Grafana-managed recording rules, which can query any Grafana data source supported by alerting.
  2. Data source-managed recording rules, which can query Prometheus-based data sources like Mimir or Loki.