AutoMerge is generally available

Generated at:

Component schema

PrometheusRuleDefinition

object1 direct reference

Definition

An individual rule within a group. A rule is either a recording rule (has record) or an alerting rule (has alert). Exactly one of record or alert must be set.

Recording rules pre-compute a PromQL expression and store the result as a new metric. Alerting rules evaluate a PromQL expression and fire alerts when the result is non-empty.

string

Name of the output metric for a recording rule. Must be a valid Prometheus metric name. Mutually exclusive with alert.

string

Name of the alert for an alerting rule. Mutually exclusive with record.

stringrequired

PromQL expression to evaluate.

For recording rules, the expression must satisfy these constraints (alerting rules are not subject to them):

  • Maximum query window: the longest matrix-selector range (or subquery range, plus lookbackDelta) may not exceed 30 days + 15 minutes.
  • Minimum evaluation interval depends on the query window — see the band table on the group's interval field, including the RR-over-RR carve-out.
  • At most 7 distinct metric names may be referenced (only enforced when the query window exceeds 1h+10m).
  • Each matrix selector must be bounded — at least one non-__name__ label matcher, an enclosing range function (rate, *_over_time, …), an enclosing by/without aggregation, or the inner metric must itself be an active recording-rule output in the same (organization, dataset).
  • At most 10 or arms (only enforced when the query window exceeds 1h+10m).
  • Self-reference is rejected: the rule's own record may not appear in its own expression.
  • Vector matching must resolve to a clean, aligned match: a binary operation matched with on() and an empty label set is rejected when the one-side operand is not statically a single series (an unaggregated selector there fails at evaluation with a duplicate-series error). Aggregate the one-side to a single series (e.g. sum(...)) or match on explicit labels with on(<labels>).
string

Duration for which the expression must be continuously satisfied before an alert fires. Only applicable to alerting rules (e.g., "5m", "10m").

string

Duration for which an alert continues firing after the expression is no longer satisfied. Only applicable to alerting rules (e.g., "5m").

object

Additional labels to attach to the resulting metrics or alerts.

object

Annotations to attach to alerts. Only applicable to alerting rules. Commonly used keys include summary and description.

Dash0 also recognizes:

  • dash0.com/notification-channel-ids: Comma-separated list of notification channels to notify when the alert fires. Each entry is a channel UUID or a channel origin, and may carry the :critical-only suffix to notify that channel only once the check reaches critical — for example dash0.com/notification-channel-ids: fbc39ea2-d6da-4c8e-b77f-730821913a3c, pagerduty-prod:critical-only. The annotation declares the routing in full: a channel it does not name is unlinked, and a channel it names without the suffix notifies on every issue, including when the only-on-critical trigger had been set in the UI.
  • dash0.com/on-no-data: The evaluation outcome when the expression returns no data. The values are critical, degraded and ignored. An absent key or an empty value means ignored. Any other value is rejected.

Used by 1

These schemas and endpoints reference this type directly.