Prometheus allows the periodic evaluation of PromQL expressions and the storage of the time series generated by them; these are called rules. There are two types of rules, as we'll see in this chapter. These rules are recording and alerting rules. They share the same evaluation engine, but have some variation in purpose, which we'll go into next.
The recording rules' evaluation results are saved into the Prometheus database as samples for the time series specified in the configuration. This type of rule can help take the load off of heavy dashboards by pre-computing expensive queries, aggregating raw data into a time series that can then be exported to external systems (such as higher-level Prometheus instances through federation, as described in Chapter 13, Scaling and Federating Prometheus), and can help to create compound...