Alert rules
Last updated: 2026-11-26T01:29:25-03:00 (UTC-3)
Alert rules watch the request log and the stored spans for the conditions you call critical, such as a burst of 5xx answers on one model, a guardrail blocking a team, p95 latency over a limit or yesterday’s spend at three times its usual level. What a rule finds becomes an alert on the Alerts screen of the console, where you acknowledge, resolve and mute it, and the rule’s channels deliver it to Slack, Microsoft Teams, email, PagerDuty or a webhook.
| Flag | Default | What it turns on |
|---|---|---|
alert_rules |
off | Rules (YAML, API and console), their evaluation, the Alerts screen, the backtest and the built-in rules |
alert_channels |
off | Delivery of the alerts to alert channels; without it alerts are still recorded and shown |
Follow this page in order the first time: turn it on, open a channel to the rules, create one rule, backtest it, then read how alerts behave.
Turn it on
Section titled “Turn it on”features: alert_rules: true alert_channels: true # only to deliver alertsalerting: channels: - id: oncall name: On-call kind: slack url_env: ONCALL_SLACK_WEBHOOK_URL events: [alert_rule] # makes the channel selectable by rules alert_rules: tick: 30s # 5s-5m: how often a replica looks for due rules items: - id: checkout-5xx name: 5xx burst on checkout scope: team team_id: checkout mode: scheduled signal: requests filters: - {field: status, op: gte, values: ["500"]} metric: count operator: gte threshold: 10 window: 5m every: 1m severity: critical cooldown: 15m channels: [oncall]The flag is read on every tick and every request, so turning it on or off needs no restart. It requires PostgreSQL (schema migration 207). Rules declared in YAML are read-only in the console; rules created in the console or through the API are stored in PostgreSQL and take effect on every replica within one tick.
Open a channel to the rules
Section titled “Open a channel to the rules”A rule delivers only to the channels it names. A channel becomes selectable when it subscribes to the alert_rule event; nothing is fanned out to it by the subscription alone.
| Channel field | Default | What it does |
|---|---|---|
events: [alert_rule] |
absent | Lets rules name this channel |
rule_organizations |
empty | Organization IDs (up to 64) whose administrators may attach the channel to their organization’s rules and to the rules of its teams |
rule_teams |
empty | Team IDs (up to 64) whose administrators may attach the channel to that team’s rules |
Global rules may use any channel that has the event. A team or organization rule may use a channel only when its team or organization is listed, because its alerts carry that tenant’s data. Set both lists in YAML, in PUT /api/v1/admin/alert-channels/{id} or in Alert channels in the console, where the two fields appear once alert_rule is ticked.
alerting: channels: - id: acme-oncall name: Acme on-call kind: pagerduty url_env: ACME_PAGERDUTY_URL events: [alert_rule] rule_organizations: [acme]PagerDuty opens one incident per alert (dedup_key alert_rule:<alert id>) with the rule’s severity, and closes it when the alert resolves. A generic webhook receives the usual envelope with event: alert_rule and an operational_event.detail holding alert_id, rule_id, rule, severity, state (firing or resolved), scope, team or organization, group, title, metric, value, threshold and window. Digests include these alerts like any other.
The rule model
Section titled “The rule model”Every rule has an identity and a scope, a condition, and how it notifies.
| Field | Default | Bounds and meaning |
|---|---|---|
id |
required in YAML | Lower case, up to 64 characters. The gateway assigns the ID of a stored rule (ar_…) |
name |
required | 1–120 characters |
description |
empty | Up to 500 characters; say what to do when it fires |
scope |
required | global (every team), organization (what was recorded in organization_id: the requests and spans that ran in it, whichever team made them) or team (what team_id recorded in the organization it is in now) |
disabled |
false |
Stops evaluation without deleting the rule |
mode |
required | realtime or scheduled |
signal |
required | requests (the request log) or spans (the span store, which needs span_store) |
filters |
none | Up to 10; every one must match |
group_by |
none | One field: the condition is judged per value and each value gets its own alert |
query |
none | With trace_query: a query in the query language, joined to the filters by AND, on a scheduled rule (alerting.alert_rules.items[].query in YAML) |
severity |
warning |
info, warning or critical |
cooldown |
15m |
1m–168h: minimum time between two notifications of the same rule and group |
channels |
none | Up to 8 channel IDs open to the rule’s scope |
Filters
Section titled “Filters”A filter is {field, op, values}. eq (the default) and neq take 1–20 values and mean any of and none of. gt, gte, lt and lte take one whole number and apply to numeric fields.
| Signal | Text fields | Numeric fields |
|---|---|---|
requests |
team, model, requested_model, provider, operation, status_class (2xx…5xx), error_code, origin, key_id, principal, end_user, guardrail, timeout_kind, service_tier |
status, duration_ms, input_tokens, output_tokens, attempts |
spans |
team, kind, subkind, name, origin, status (ok, error, unset), error_code, model, provider, key_id, principal |
http_status, duration_ms |
Values are plain identifiers (letters, digits and . _ : / @ -, up to 200 characters). A rule never reads prompts, answers or headers: only the metadata the request log and the spans already hold. group_by takes any text field above except end_user and service_tier, plus status and http_status.
A query beside the filters
Section titled “A query beside the filters”With trace_query on, a scheduled rule you define may also carry a query in the gateway’s query language, joined to the filters by AND: query: "canary.side:canary status:error -origin:evaluation". signal: requests reads the request log’s fields, including span fields (the requests that have such a span) and evaluation terms; signal: spans reads the span fields (child. and parent. are refused). A rule has no reader, so a text search of captured content is refused. A realtime or built-in rule keeps its filters. If trace_query is turned off, a rule with a query is not scanned (state query_disabled) rather than run without it. See the query language in an alert rule.
Realtime rules
Section titled “Realtime rules”- id: guardrail-blocks name: Guardrail blocked a request scope: global mode: realtime signal: requests filters: - {field: error_code, values: [guardrail_blocked]} group_by: team severity: warningA realtime rule has filters only (at least one). Each request is matched in memory when its request log row is recorded, and each span when the span writer keeps it; a match is offered to a bounded queue (2,048) and never waits on the database, so the request path does no I/O. One writer per replica folds matches by rule and group for one second and writes each fold once, so a burst of 500 matches a second costs one write per group, with the count added to the alert. A match that finds the queue full is dropped and counted (gateway_alert_rule_alerts_total{transition="dropped"}).
Use a realtime rule for conditions where one occurrence matters. For “more than N in a window”, rates and latency, use a scheduled rule.
Rules over prompt events
Section titled “Rules over prompt events”With prompt_events on, signal: prompts matches each change of the prompt registry as it is recorded: a team’s rule sees its own team’s prompts, an organization’s rule the prompts of its teams, a global rule every prompt. It is realtime only (a scheduled one is refused) and has no backtest (409 backtest_unavailable).
| Field | Type | What it is |
|---|---|---|
event |
text | prompt_created, prompt_version_published, prompt_deleted or prompt_label_deployed |
prompt_id |
text | The prompt |
team |
text | The prompt’s owning team |
path |
text | How the change was made: console, api or yaml |
label |
text | The label a prompt_label_deployed event moved (empty otherwise) |
revision |
number | The revision published (or the last one, for a creation or a deletion) |
- id: checkout-prompt-publications name: A checkout prompt was published scope: team team_id: checkout mode: realtime signal: prompts filters: - {field: event, values: [prompt_version_published]} group_by: prompt_id severity: info channels: [checkout-oncall]With the flag off the rule is refused when saved (409 feature_disabled) and a stored one stops matching.
Rules over finished experiments
Section titled “Rules over finished experiments”With experiment_traces on, signal: experiments matches each experiment run of its own team or organization as it finishes (completed, failed or canceled). Realtime only, no backtest (409 backtest_unavailable); with the flag off it is refused when saved (409 feature_disabled).
| Field | Type | What it is |
|---|---|---|
team |
text | The run’s team |
status |
text | completed, failed or canceled |
dataset_id |
text | The dataset the run ran |
model |
text | The alias the items called |
suite_id |
text | The regression suite of a suite run |
verdict |
text | A suite run’s verdict: passed, failed or error |
items |
number | The run’s items |
failed |
number | The items whose model call failed |
duration_ms |
number | From the run’s creation to its end |
- id: release-gate-failed name: The release gate failed scope: team team_id: checkout mode: realtime signal: experiments filters: - {field: verdict, values: [failed]} severity: warning channels: [checkout-oncall]Scheduled rules and scans
Section titled “Scheduled rules and scans”- id: slow-chat name: Chat p95 above 8 s scope: organization organization_id: acme mode: scheduled signal: requests filters: - {field: operation, values: [chat]} metric: p95_latency_ms operator: gt threshold: 8000 min_samples: 50 window: 15m schedule: "*/5 * * * *" group_by: model| Field | Default | Bounds and meaning |
|---|---|---|
metric |
count |
Requests: count, error_count, error_rate, avg_latency_ms, p50_latency_ms, p95_latency_ms, p99_latency_ms, spend_usd, total_tokens. Spans: the first seven |
operator |
gte |
gt, gte, lt or lte |
threshold |
1 for a count |
0–1e15; error_rate is a ratio from 0 to 1. A count with lte 0 is a “no traffic” rule. Any other metric needs a threshold: gte 0 is always true and is refused |
min_samples |
0 |
Matching rows a rate or latency needs before it is judged; below it the scan reports no data |
window |
5m |
1m–744h, whole seconds: the time range each scan reads |
every |
1m |
30s–24h: a fixed interval |
schedule |
none | A five-field cron expression in UTC (minute hour day-of-month month day-of-week, with *, numbers, ranges a-b, lists a,b and steps */n); set schedule or every, not both |
A scan is one bounded aggregate over the window: at most 50 groups (the highest values, or the lowest for lt and lte), 5 sample rows per alert, a 10-second statement timeout and a 15-second budget per rule. Metrics count every matching row, helper calls and fallback attempts included; add {field: origin, values: [app]} to count client requests only. An error is a status of 400 or more, or an answer cut after it started. spend_usd sums known valuations: when no matching row is priced it is unknown, never zero, and the rule does not fire.
Where a scan reads. Requests are read from the analytics store while analytics may read it (analytics_store_usage on, the copy complete and within its maximum lag), and from PostgreSQL otherwise or when that read fails. spend_usd always reads PostgreSQL, where the valuations are. Spans are read from the analytics store when it is the span engine, and from PostgreSQL otherwise. Each alert and each rule’s last scan say which (read_store). The same scan returns the same rows on both engines.
One replica per scan. Every replica looks for due rules each tick, and a rule’s lease on the database clock lets one replica scan it at a time; a lease left by a crashed replica expires after two minutes. A scan that outlives its lease writes nothing. A replica runs at most 50 scans per tick, the longest overdue first, at most 10 of one team or organization, and stops starting scans once they have used the tick itself. A cron rule first runs at its next slot, not when it is created; a schedule that can never run (February 30) is refused.
A scheduled rule resolves its own alerts: when a scan completes and a group no longer meets the condition, its alert is resolved by system and, when the alert had notified, a resolved message goes to the rule’s current channels.
Backtest before you save
Section titled “Backtest before you save”Backtest 24 h in the rule editor (POST /api/v1/admin/alert-rules/preview) answers what the rule would have matched in the last 24 hours, without saving it or notifying anyone:
- a realtime rule: the matches per hour;
- a scheduled rule: the value of its metric on consecutive windows of its own
window(at least five minutes; one window when it is 24 hours or longer), and in how many it would have fired. This approximates the rule’s sliding evaluation; a rule with a window under five minutes is judged on five-minute windows, so its counts read higher than a real scan’s; - a built-in rule: what it would raise if it ran now;
- up to 20 of the newest matching rows, each a link to its request or trace.
Tune the threshold until the number of firing windows is what you would want to be paged for, then save.
Built-in rules
Section titled “Built-in rules”Five rules are ready-made. None exists until you turn it on, for the scope you choose, under Rules → Built-in rules or by declaring a rule with builtin:. Each then behaves as an ordinary rule: tune it, mute it, delete it.
builtin |
Fires when | Defaults |
|---|---|---|
spend_spike |
spend of the last 24 hours ≥ multiplier × the daily baseline and at least minimum_increase USD above it |
3×, 50 USD |
traffic_spike |
requests of the last 24 hours, the same way | 10×, 1,000 requests |
latency_spike |
p95 latency of the last 24 hours against the average daily p95 | 3×, 500 ms, min_samples 100 |
error_rate_spike |
error rate of the last 24 hours against the average daily error rate | 3×, 0.05, min_samples 100 |
deprecated_model_traffic |
a deprecated model received requests in the last 30 days | one alert per model |
- id: spend-by-team name: Daily spend spike scope: global builtin: spend_spike multiplier: 2.5 # 1.1-1000 minimum_increase: 20 # in the metric's unit baseline_days: 14 # 2-28, default 7 group_by: team channels: [finance]The baseline is the average of the baseline_days full days before the last 24 hours, per group. A group needs two baseline days with data before it is judged. For spend and traffic a day without requests since the first day with data counts as zero; for latency and error rate only days with requests are averaged. Spike rules run hourly (cron 5 * * * *) with a 24-hour cooldown unless you set every, schedule or cooldown. Each alert carries the daily series it was judged on.
deprecated_model_traffic watches the models you declare and, with the model registry on, the gateway models whose upstream model a source publishes with a deprecation date:
- id: deprecated name: Traffic to deprecated models scope: global builtin: deprecated_model_traffic deprecated_models: - {model: gpt-4-0613, date: "2026-12-01"} - {model: legacy-chat}A declared name is a gateway model ID or an upstream model name; an upstream name covers every gateway model that targets it. The alert of each model shows its requests per day for the last 30 days, the last request, the deprecation date and where the deprecation came from (declared, registry_scheduled or registry_date_passed). The registry is advisory and may be unreachable: the alert then says registry: unavailable, only declared models are checked, and no alert is resolved by that run. It runs daily at 06:00 UTC and resolves a model’s alert once 30 days pass without traffic.
The Alerts screen
Section titled “The Alerts screen”Alerts in the console navigation has two tabs.
Alerts lists what the rules found, newest first, with filters by state (active, open, acknowledged, resolved), severity and text. Each alert shows its severity, state, owner, rule, group, how many times it was seen and when. Details shows the value against the threshold or baseline, the window, the filters, the daily series of a built-in rule and the matched samples; Request opens a sample’s request journey, Trace its trace, and Matching logs opens the request log filtered to the alert’s team, window and filters.
| Action | Effect |
|---|---|
| Acknowledge | Marks an open alert as being handled; it stays active and keeps counting |
| Resolve | Closes the alert. A notified alert of a rule sends resolved to the rule’s current channels. A later match opens a new alert |
Mute (1 hour to 7 days in the console, 1m–720h in the API) |
The alert keeps counting but sends no notification until the mute ends |
| Unmute | Ends the mute |
Rules lists every rule you may see with what it watches, when it runs, its last scan (ok, firing, no data or error with its class) and its next run. From it you create, edit, mute and delete rules and turn on the built-in ones. Deleting a rule resolves its active alerts and keeps them in the history.
How an alert lives
Section titled “How an alert lives”- One active alert per rule and group. A new finding adds to the open or acknowledged alert (
occurrences,last_seen_at, the latest detail); it never opens a second one. This holds across replicas. - Notifications. The first finding notifies. Further findings notify again only after
cooldownsince the last notification of that rule and group, also across a resolve and reopen. A muted alert or a muted rule records and does not notify. - Retention. Resolved alerts are deleted 90 days after they were resolved. Active alerts are kept.
Who sees what
Section titled “Who sees what”Access is by permission inside the roles, scoped to the caller’s teams and organization:
| Permission | Allows | Built-in roles |
|---|---|---|
alert_rules:read |
Listing alerts and rules of your teams, and of the organization you administer | admin, viewer, operator, team_admin, team_viewer, user |
alert_rules:manage |
Creating, editing, muting and deleting rules; acknowledging, resolving and muting alerts; the backtest | admin, team_admin (its administered teams; an organization admin also its organization) |
alert_rules:global |
Widens both to every team, every organization and the global rules | admin, viewer and operator (read only) |
- A global rule sees every team’s traffic and its alerts name teams, so only sessions with
alert_rules:globalsee or change it. - An organization rule aggregates the organization’s teams: its alerts are visible to that organization’s administrators, not to members of one team.
- When a team moves to another organization, its rule stops counting what it recorded under the former one, the former organization’s rule keeps counting that and nothing the team does since, and the new organization’s rule counts the team from the move on. A row that records no organization (
organizationsoff) stays with its team. A scheduled rule’squeryfollows the rule: its evaluation and span terms are resolved over the same rows the scan counts, so an organization’s rule matches the results a team that left recorded there and a team’s rule only those of its organization of now. The alerts themselves follow:GET /api/v1/admin/alertsshows a team’s reader the alerts raised while the team was in its current organization, and shows the former organization’s administrators the ones raised there, which they read (in the list and among the records of a trace) and cannot acknowledge, resolve or mute. An alert raised before the upgrade records no organization and stays with its team. See when a team moves. - A team rule and its alerts are visible to the team’s members and managed by its administrators.
- Anything outside your scope answers
404, the same as a missing object, and a filter never widens it. Channels of other tenants are not listed, and naming one answers the same422as a channel that does not exist. - A custom role narrows these and is read-only, like every custom role: it may keep
alert_rules:read(and, based onvieweroroperator,alert_rules:global), neveralert_rules:manage. One based onviewerwithoutalert_rules:globalsees no global object.
Every write is audited: alert_rule.create, .update, .delete, .mute, .unmute, and alert.acknowledge, .resolve, .mute, .unmute.
Alerts other features raise
Section titled “Alerts other features raise”Some features raise their own alerts through the same screen, states, cooldown and channels: an alert’s source names the raiser (rule for a rule of yours). Topics raises findings with the sources topics (a topic changed) and insights (cost and reliability detectors), and its budget and provider pauses with topics. Filter the list by raiser with GET /api/v1/admin/alerts?source=topics.
Alerts as telemetry
Section titled “Alerts as telemetry”An alert is part of the gateway’s own telemetry, not a separate system.
- Logs. Each transition (
opened,acknowledged,resolved) writes analert_ruleline to stdout and to OTLP logs withalert_id,rule_id,rule,source,severity,scope,team,organization_id,group,state,occurrences,title,valueand, when a row matched,matched_request_id,matched_trace_idandmatched_span_id. Join them with the request log and the traces by those IDs. - Metrics, at
/metricsand over OTLP:
| Series | Labels |
|---|---|
gateway_alert_rule_alerts_total |
transition (opened, repeated, notified, acknowledged, resolved, dropped), severity, scope, source |
gateway_alert_rule_scans_total |
outcome (ok, firing, no_data, error, lost_lease) |
gateway_alert_deliveries_total |
channel, outcome (the existing delivery counter) |
Rule, team and organization IDs are never metric labels.
Raising alerts from another feature
Section titled “Raising alerts from another feature”Evaluation monitors and other gateway features raise their alerts through the same interface, so they land on the same screen with the same lifecycle. Inside the gateway:
alert, err := s.RaiseAlertSignal(ctx, gateway.AlertSignal{ Source: "evaluation_monitor", // lower snake case; the alert's source MonitorID: monitor.ID, // up to 64 characters Name: monitor.Name, TeamID: monitor.TeamID, // the alert is team-scoped Group: evaluator.ID, // optional: one alert per group Severity: "warning", // info, warning or critical Title: "Pass rate 0.62 below 0.80 over 1h", Detail: map[string]any{"metric": "pass_rate", "value": 0.62, "threshold": 0.8, "operator": "lt"}, Cooldown: time.Hour, // 0: 15m Channels: monitor.Channels, // only those open to the team receive it})// when the monitor's condition clears (firing lists the groups still failing):err = s.ResolveAlertSignal(ctx, signal, firing)RaiseAlertSignal folds into the active alert of Source, MonitorID and Group, honors the cooldown and the alert’s mute, and queues deliveries only for channels open to the team. With alert_rules off it does nothing and returns ErrAlertRulesDisabled. Detail is bounded metadata (12 KiB), never content; the screen understands metric, value, threshold, operator, window_from, window_to, group_by, group and samples.
Limits
Section titled “Limits”- Realtime rules are matched per replica from what that replica served. Their findings fold into one alert in PostgreSQL, but a match queued on a replica that crashes within the one-second fold is lost; a scheduled rule over the same filters is the durable check.
- A scheduled rule sees a request once its request log row is written, and reads the analytics store up to that copy’s lag behind.
- With
group_by, a scan judges the 50 highest groups (the 50 lowest forltandlte) and opens at most 20 alerts per scan; the other groups that meet the condition keep the alerts they have. A scan that returned 50 groups does not resolve alerts, since a missing group is then not proof that it cleared. A group with no matching row returns nothing, so a grouped “no traffic” rule cannot see a silent group: use one rule per group, or an ungrouped rule. - A rule deleted or disabled stops matching on the other replicas within one
tick; a stored rule’s queued matches are discarded once it is deleted. - Realtime alerts do not resolve by themselves: resolve them on the screen. Scheduled and built-in alerts resolve when the condition clears.
- The gateway stores at most 50 rules per team, per organization and for the global scope, 500 in all; YAML holds at most 200. A YAML rule may name only a YAML channel that is open to its scope.
- The alert list pages by last occurrence: an alert that fires again while you page moves to the top, so a later page can miss it until you refresh.
- Spans rules need
span_store; with it off a scheduled span rule reportsspan_store_disabledon each scan and a realtime one never matches. - A rule cannot change its scope, organization or team; create another rule.
YAML reference
Section titled “YAML reference”Every key of alerting.alert_rules, with where it is explained above. The API and the console take the same fields under the same names.
| Key | Default | What it is |
|---|---|---|
alerting.alert_rules.tick |
30s |
How often each replica looks for due scheduled rules and reloads the realtime ones, 5s–5m |
alerting.alert_rules.items[].id |
required | The rule’s identifier in YAML, lower case, up to 64 characters |
alerting.alert_rules.items[].name |
required | Display name of the rule, 1–120 characters |
alerting.alert_rules.items[].description |
empty | Free text shown with the rule, up to 500 characters |
alerting.alert_rules.items[].scope |
required | Whose traffic the rule reads: global, organization or team |
alerting.alert_rules.items[].organization_id |
empty | The organization of an organization rule |
alerting.alert_rules.items[].team_id |
empty | The team of a team rule |
alerting.alert_rules.items[].disabled |
false |
Stops the rule without removing it |
alerting.alert_rules.items[].mode |
required | realtime or scheduled; a built-in rule is always scheduled |
alerting.alert_rules.items[].signal |
required | requests or spans; a built-in rule always reads requests |
alerting.alert_rules.items[].filters[].field |
required | The field a filter compares, from the filter table |
alerting.alert_rules.items[].filters[].op |
eq |
The comparison: eq, neq, gt, gte, lt or lte |
alerting.alert_rules.items[].filters[].values |
required | The values compared, 1–20 for eq and neq, one number otherwise |
alerting.alert_rules.items[].metric |
count |
The aggregate a scheduled rule judges |
alerting.alert_rules.items[].operator |
gte |
How the metric compares with the threshold |
alerting.alert_rules.items[].threshold |
1 for a count |
The value the metric is compared with |
alerting.alert_rules.items[].min_samples |
0 |
Matching rows a rate or latency needs before it is judged |
alerting.alert_rules.items[].window |
5m |
The time range each scan reads, 1m–744h |
alerting.alert_rules.items[].group_by |
none | One field whose every value is judged and alerted separately |
alerting.alert_rules.items[].schedule |
none | A five-field cron expression in UTC for when the rule runs |
alerting.alert_rules.items[].every |
1m |
A fixed interval between runs, 30s–24h |
alerting.alert_rules.items[].severity |
warning |
info, warning or critical, shown and delivered with the alert |
alerting.alert_rules.items[].cooldown |
15m |
Minimum time between two notifications of one rule and group |
alerting.alert_rules.items[].channels |
none | Up to 8 alert channel IDs that receive the rule’s alerts |
alerting.alert_rules.items[].builtin |
none | Turns the item into one of the built-in rules |
alerting.alert_rules.items[].multiplier |
per built-in | How many times the baseline a spike must reach, 1.1–1000 |
alerting.alert_rules.items[].minimum_increase |
per built-in | How far above the baseline a spike must be, in the metric’s unit |
alerting.alert_rules.items[].baseline_days |
7 |
Full days averaged into a spike rule’s baseline, 2–28 |
alerting.alert_rules.items[].deprecated_models[].model |
required | A gateway model ID or upstream model name declared deprecated |
alerting.alert_rules.items[].deprecated_models[].date |
empty | Its published deprecation date, YYYY-MM-DD, shown in the alert |
Admin API routes
Section titled “Admin API routes”Every route needs a console session or an admin Bearer token, the permission shown and, for writes, the X-CSRF-Token header; the full contract is in the API reference.
| Route | Permission | What it does |
|---|---|---|
GET /api/v1/admin/alerts |
alert_rules:read |
Alerts newest first with state, severity, rule_id, team, organization, scope, q, limit (1–200) and cursor, and the counts by state |
GET /api/v1/admin/alerts/{id} |
alert_rules:read |
One alert |
POST /api/v1/admin/alerts/{id}/{action} |
alert_rules:manage |
acknowledge, resolve, mute ({"duration":"1h"}) or unmute |
GET /api/v1/admin/alert-rules |
alert_rules:read |
Rules (alert_rules.items, with the effective alert_rules.tick) and their last scan, the catalog of fields, metrics and built-in rules, and the channels you may attach |
POST /api/v1/admin/alert-rules |
alert_rules:manage |
Creates a rule; the gateway assigns its ID |
POST /api/v1/admin/alert-rules/preview |
alert_rules:manage |
The 24-hour backtest of an unsaved rule |
PUT /api/v1/admin/alert-rules/{id} |
alert_rules:manage |
Replaces a stored rule: {"version": n, "rule": {...}} |
DELETE /api/v1/admin/alert-rules/{id}?version=n |
alert_rules:manage |
Deletes a stored rule and resolves its active alerts |
POST /api/v1/admin/alert-rules/{id}/mute |
alert_rules:manage |
Mutes a rule ({"duration":"24h"}) or unmutes it ({}) |
curl --fail-with-body -sS -b "$COOKIE_JAR" -X POST \ -H "X-CSRF-Token: $CSRF_TOKEN" -H 'Content-Type: application/json' \ --data-binary '{"name":"5xx burst","scope":"team","team_id":"checkout","mode":"scheduled","signal":"requests","filters":[{"field":"status","op":"gte","values":["500"]}],"metric":"count","operator":"gte","threshold":10,"window":"5m","every":"1m","severity":"critical","channels":["oncall"]}' \ "$BASE_URL/api/v1/admin/alert-rules"Upgrade
Section titled “Upgrade”Migration 207 adds three tables (gateway_alert_rules, gateway_alert_rule_state, gateway_alerts) and changes no existing row. Upgrade every replica before turning the flag on: an older replica neither matches realtime rules nor understands the alert_rule event of a channel. Turning the flag off stops evaluation and hides the screen; rules and alerts stay stored.
See also
Section titled “See also”- Alert channels, operational events and digests.
- Logs, traces and metrics and the Prometheus alert rules, which page from metrics when the gateway itself is unhealthy.
- Access control.