Comparators
The seven ways an alert rule can test a metric. For how comparators fit into rule authoring, see Alert rules.
Source of truth: packages/domain/src/alerting/RuleShape.ts (comparatorSpec) and
RulePhrase.ts (COMPARATOR_VERB).
| Comparator | Reads as | Required fields | Valid metric kinds |
|---|---|---|---|
lt |
falls below | threshold | gauge |
gt |
rises above | threshold | gauge |
outside_band |
moves outside | low + high threshold | gauge |
rate |
changes faster than | threshold + window | gauge |
pct_over_baseline |
exceeds baseline by | threshold + baseline + window | gauge |
min_over_window |
stays above | threshold + window | gauge — flow metrics only |
stale |
reports no data for | window | any kind |
- Field names. threshold is the trip value; low + high threshold is a band (
outside_band); baseline is the reference the metric is measured against; window is a duration in seconds. min_over_windowis the continuous-flow / customer-side-leak detector — a window whose minimum never drops. It is valid only for the flow metric (flow_rate_lpm).staleis the odd one out: it tests age-since-last-seen, not a value, so it binds to a metric of any kind and only needs a window. Its alert always surfaces as offline.- Every non-
stalecomparator additionally accepts an optional clear value (hysteresis) and a debounce count — see Alert rules.
Related
Section titled “Related”- Alert rules — comparators in the context of authoring a rule
- Metric catalogue — the metric kinds each comparator binds to