Recording rules are a useful concept of Prometheus. They allow you to speed up heavy queries and enable subqueries in PromQL that otherwise would be very expensive. Alerting rules are similar to recording rules, but with alert-specific semantics. As testing is a fundamental part of any system, you'll have the opportunity in this chapter to learn how to ensure that recording and alerting rules behave as expected before being deployed. Understanding these constructs will help make Prometheus faster and more robust, as well as enabling its alerting capabilities.
The following topics will be covered in this chapter:
- Creating the test environment
- How does rule evaluation work?
- Setting up alerting in Prometheus
- Testing your rules