alerts.read, and creating or changing them requires alerts.manage.
Rule types
The rule list
Rules lists every rule with its data source, its trigger condition, its state, and its last evaluation. Search by rule, service, or source, and switch between All, Enabled, and Disabled.
Select a rule, or Edit in its row, to open it.
Create a threshold rule
Select New rule → Threshold rule to open the rule workbench.1
Choose the rule type
Choose Metric alert, Log alert, Trace alert, APM alert, or RUM alert. Under
Quick start, a preset fills in a typical query, such as High error rate, High P95
latency, Error log spike, or No data. APM and RUM alerts pick a service or an application
and a figure instead of a query; see Alert on APM figures and
RUM alerts.
2
Fill in the basic information
The Rule name titles the incidents, for example
api_high_error_rate. Service ties the rule
to a service for ownership and cross-signal context. Description says what the rule protects.3
Write the query
Set the Target stream, the Evaluation interval (every 1, 5, or 10 minutes), the
Query language (PromQL for metrics, SQL otherwise), and the Query. The query must
return a number: the evaluator reads the first column of the first row. Optionally fill in
Split by.
4
Set the trigger conditions
Each row is a severity: When result is compared with the Threshold by an operator, And
for a number of minutes. Add severity adds another row. The highest severity that matches
wins, and a higher severity cannot be easier to reach than a lower one. The minutes become a number
of evaluations. Set Recovery and When there is no data below.
5
Add response guidance
Under Notify and response, enter a Response guide / Runbook URL. Responders open it from the
incident list. Who is told is decided by the escalation policy
and the Notify policies, not by the rule.
6
Test the rule
Select Test rule. The query runs on the real data of the last 6 hours, and Query preview
draws the result with the threshold line, the current value, the estimated number of triggers, the
rows scanned, and the latency. A split rule shows how many groups it found.
7
Save
Pre-create checks must all be ready: a name, a successful test of the current query, valid
thresholds, and a valid runbook URL. Then select Save and enable, or Save draft to keep the
rule without running it.
default. An organization without
one opens incidents that escalate to nobody: create it first. See
The default policy.
Split a rule by columns
A scheduled rule on a SQL or PromQL query can be split by columns of its result, such as the host or the service. Set Split by in the rule workbench, orquery.group_by when you create a rule. Each group of values then behaves as a rule of its own.
Return one row for each group, the worst first:
sum by (instance) (rate(http_requests_total{status=~"5.."}[5m])) splits by instance. When the result has rows but no column of that name, the round fails and nothing changes. Testing a query in the rule workbench checks the columns. APM, RUM, real-time, and anomaly rules are not split.
Recovery and missing data
Every rule says when an open incident recovers and what an evaluation without a value counts as. Set them under Recovery and When there is no data in the rule workbench, or astrigger.recovery and trigger.no_data when you create a rule.
- Recovery threshold: an open incident waits for the value to cross back over this line, for example a rule that fires above 90 recovers below 80. A value that hovers around the threshold no longer fires and recovers over and over.
- Recovery duration: the value has to stay on the healthy side for this long before the incident recovers.
- When there is no data: the query returned no value, or a group of a split rule is missing from the result.
Real-time rules take neither setting: they resolve as soon as their count drops.
Anomaly rules
An anomaly rule fires when a value leaves the band that its own history predicts, so it needs no fixed threshold. Select New rule → Anomaly detection rule.Real-time rules
A real-time rule runs on the intake path instead of on a timer. Every record that an intake node accepts is checked against the real-time rules of its stream, and the matches go into a sliding window ofperiod_secs seconds. The rule fires as soon as the number of matches in the window meets the trigger, and an incident resolves when the count no longer meets it.
Create a rule rejects a real-time rule outside these limits with
400. Counting happens in memory on each intake node and starts at zero after a restart. In a role-split cluster, every intake node counts the records it receives, so size the threshold for one node.