Recording rule support in Infrastructure as Code
Dashboard queries that aggregate large volumes of raw metrics can be slow and expensive.
You can now define recording rules as code using the Dash0 CLI, Terraform provider, and Kubernetes operator, so pre-computed time series are version-controlled and deployed alongside the rest of your infrastructure.
Recording rules let you evaluate PromQL expressions on a schedule and store the results as new time series. This means dashboards and alerting rules can query the pre-computed series instead of recalculating them on every load. You author rules in the standard PrometheusRule CRD format (monitoring.coreos.com/v1), so the syntax is already familiar if you have worked with the Prometheus Operator.
How it works
Each recording rule is scoped to a dataset and defined as a YAML document that follows the PrometheusRule specification. Inside the YAML you declare one or more rule groups, each with an evaluation interval and a list of rules entries that pair a record name with a PromQL expr. Dash0 evaluates these expressions on the configured cadence and writes the resulting series back into the dataset, ready for dashboards and alert conditions.
Dash0 CLI
# Create recording rules from a YAML file
dash0 recording-rules create --dataset default -f recording-rules.yaml
# List all recording rules in a dataset
dash0 recording-rules list --dataset default
# Get a single recording rule by ID
dash0 recording-rules get --dataset default <id>
# Update an existing recording rule
dash0 recording-rules update --dataset default <id> -f recording-rules.yaml
# Delete a recording rule
dash0 recording-rules delete --dataset default <id>
Dash0 Terraform Provider
resource "dash0_recording_rule" "http_metrics" {
dataset = "default"
recording_rule_yaml = file("${path.module}/rules/http-recording-rules.yaml")
}
Dash0 Operator for Kubernetes
apiVersion: operator.dash0.com/v1alpha1
kind: Dash0RecordingRule
metadata:
name: http-recording-rules
namespace: monitoring
spec:
dataset: default
content: |
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: my-recording-rules
spec:
groups:
- name: http_metrics
interval: 1m
rules:
- record: http_requests:rate5m
expr: rate(http_requests_total[5m])
The operator syncs the recording rule to Dash0 and reports status back on the custom resource.
Fetched June 3, 2026



