Recording rules pre-compute PromQL expressions and store the results as new time series in RHOBS. They are used to create derived metrics that would be too expensive or complex to compute at query time or to precompute them if they are in high demand — most commonly the konflux_up availability metric that powers the SLO dashboard and the Tactical Status Page.
Recording rules are defined as PrometheusRule resources in the rhobs/recording/ directory. They share the same Kubernetes kind, deployment pipeline, and testing toolchain as alerting rules.
- Create a new rule file in
rhobs/recording/— use the recording rule template as a starting point - Write a corresponding test file in
test/promql/tests/recording/— use the test template and see Test file format - Run validation — see Validation and testing
- Open a PR
Recording rules share the same validation toolchain as alerting rules. All commands run inside a container — no local tool install needed.
make check-and-test
For faster iteration on a single rule:
make selective-check-and-test \
RULE_FILES="rhobs/recording/my_recording_rules.yaml" \
TEST_CASE_FILES="test/promql/tests/recording/my_recording_rules_test.yaml"
YAML linting:
make sync_pipenv # first time only
make lint_yamls
Tests use promtool's unit test format — use the recording rule test template as a starting point.
Test both the expected-up and expected-down cases. For rules with namespace or label filters, include a test case where the input data doesn't match the filter to verify the rule produces no output.
Recording rules in this repository are evaluated by RHOBS (Red Hat Observability Service), not by in-cluster Prometheus. Any metric used in a recording rule expression must first be forwarded to RHOBS via infra-deployments. A rule referencing a metric that isn't forwarded will silently produce no data.
Recording rules that need to be evaluated by in-cluster Prometheus (rather than RHOBS) are defined in infra-deployments.
Use cluster-level recording rules when the derived metric is only needed in-cluster, or the metric has a high cardinality that would use a large amount of our RHOBS metrics quota (quota is ~10 million in production and ~1 million in stage).
Recording rules are deployed via the same pipeline as alerting rules — see ALERTS.md § Deployment Model. Both use the same app-interface saas file.
Use the recording rule template as a starting point. All fields are documented with [required] / [optional] tags in the template.
konflux_up is a standardized boolean metric that every Konflux service should expose. It enables a unified SLO dashboard and the Tactical Status Page to show fleet-wide availability. See ALERTS.md § Availability alerts for the full specification of required labels and how signals are created.
Use the availability recording rule template for the standard deployment replica pattern. The template includes inline comments explaining each step.