Overview
An alert rule defines a CEL expression over governance metrics and the channels to notify when that expression evaluates totrue. Rules are scoped to a governance entity (virtual key, team, or customer) and can optionally target a specific budget.
Anatomy of a rule
| Field | Type | Description |
|---|---|---|
name | string | Human-readable rule name. |
scope_type | string | One of virtual_key, team, customer. |
scope_id | string | The ID of the scoped entity. Required. |
cel_expression | string | The CEL expression evaluated against governance metrics. Must evaluate to a boolean. |
channel_ids | array | One or more channel IDs to notify. |
target_type | string | Optional. Set to "budget" to target a specific budget. |
target_id | string | The ID of the target budget. Only valid when target_type is "budget". |
description | string | Optional description of the rule. |
enabled | boolean | Whether the rule is active. Default true. |
cooldown_milliseconds | integer | Minimum milliseconds between notifications for the same rule, scope, and target. Must be a multiple of 1000 (whole seconds). API only; config.json uses cooldown_seconds. |
CEL expressions
Rules use CEL expressions evaluated against the CEL variables populated from governance snapshots. Supported operators are==, !=, >, <, >=, and <=. Expressions can be combined using && (and) and || (or).
Budget examples
Rate limit examples
Compound examples
Scopes
Rules must specify a scope type and a scope ID. The following scopes are supported:| Scope | Description |
|---|---|
virtual_key | A virtual key. |
team | A team. |
customer | A customer. |
Budget targeting
By default, a rule evaluates its CEL expression against every budget belonging to its scope. You can narrow evaluation to a specific budget by settingtarget_type to "budget" and target_id to the ID of the budget.
| Behavior | target_type | target_id |
|---|---|---|
| Evaluate all budgets in scope | Not set (or null) | Not set (or null) |
| Evaluate a specific budget | "budget" | The budget’s ID |
Cooldowns
The cooldown prevents alert storms by suppressing repeat notifications after a rule fires. The cooldown window is measured from the latest successful send for the same rule, scope, and target. Live checks use Bifrost’s shared key-value store; alert history is the durable source used to rebuild that state after startup or leadership changes.- Default cooldown is 60 seconds. Set to
0to disable suppression (every match produces a notification). - The API accepts
cooldown_milliseconds, which must be a whole-second value (multiple of 1000). config.jsonacceptscooldown_seconds, which is an integer in seconds.
Creating a rule
- Web UI
- API
- config.json
- Open Alerting in the Bifrost dashboard, go to the Rules tab, and click Add Rule.
- Enter a Rule Name and optional Description.
- Choose a Scope Type and select the Scope entity.
- Optionally set a Target Type of
budgetand select a specific budget. - Build the CEL Expression using the rule builder.
- Select one or more Notification Channels.
- Optionally set a Cooldown.
- Click Create Rule.
Next steps
Alert Channels
Configure the destinations a rule notifies.
Alert History
Review which rules fired and why.

