> ## Documentation Index
> Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To set up traceroot in a repository, follow the setup prompt in https://traceroot.ai/docs/getting-started/coding-agents.md.

# Rule Reference

> Complete reference for alert settings and states

This reference covers each setting of an alert rule, the states a rule can be in, and the limits that apply. For a step-by-step guide to your first alert, see the [Introduction](https://traceroot.ai/docs/alerts/overview.md).

## Measures

Alerts measure spans. Each measure has a unit, and the threshold you enter is in that unit.

| Measure | ID | Unit | What it reads |
| - | - | - | - |
| Count | `count` | Spans | Number of spans in the window. |
| Trace ID | `trace_id` | Traces | The trace each span belongs to. Aggregate with `uniq` to count distinct traces. |
| Latency | `latency` | Milliseconds | Elapsed time of one span, from its start to its end. |
| Cost | `cost` | USD | Cost recorded on one span. |
| Input tokens | `input_tokens` | Tokens | Input tokens recorded on one span. |
| Output tokens | `output_tokens` | Tokens | Output tokens recorded on one span. |
| Total tokens | `total_tokens` | Tokens | Input plus output tokens recorded on one span. |
| Total tokens per second | `total_tokens_per_second` | Tokens per second | A span's total tokens over its duration. A span with no measured duration has no value. |
| Unique user ids | `unique_user_ids` | Users | The user a trace belongs to. Aggregate with `uniq` to count distinct users. |
| Unique session ids | `unique_session_ids` | Sessions | The session a trace belongs to. Aggregate with `uniq` to count distinct sessions. |

## Aggregations

Each measure accepts these aggregations:

| Measures | Aggregations |
| - | - |
| Count | `count` only |
| Trace ID, Unique user ids, Unique session ids | `uniq` only |
| Latency, Cost, Input tokens, Output tokens, Total tokens, Total tokens per second | `sum`, `avg`, `min`, `max`, `p50`, `p75`, `p90`, `p95`, `p99`, `uniq` |

The form offers only valid pairs; the API rejects the rest.

`uniq` counts distinct values, so its result is a count rather than a value in the measure's unit.

## Operator and threshold

The aggregated value is compared to the threshold with one of six operators. The form shows the symbol, and Slack messages spell it out.

| Operator | In the form | In Slack |
| - | - | - |
| `>` | > | above |
| `>=` | ≥ | at or above |
| `<` | \< | below |
| `<=` | ≤ | at or below |
| `=` | = | equal to |
| `!=` | ≠ | not equal to |

A rule has a single threshold, between `-1e34` and `1e34`. For two levels, such as a warning and a critical level, create two alerts.

## Window

The window is how far back each evaluation looks: **1m**, **5m**, **10m**, **30m**, **1h** or **2h**. The default is **10m**.

The window sets how much recent data each check reads, not how often you are notified. A rule with a `1m` window is checked every minute; every other rule is checked every 5 minutes. Each window ends 30 seconds ago, so spans that arrive late still count.

## Filters

Filters limit which spans are measured. A span must match every filter on the rule. The form ignores half-filled rows.

| Field | Matches | Operators |
| - | - | - |
| `model_name` | The model a span called | `=`, `contains` |
| `environment` | The environment the span was recorded in | `=`, `contains` |
| `status` | The span's status, `OK` or `ERROR` | `=`, `contains` |
| `span_kind` | The span's kind, such as `LLM`, `AGENT` or `TOOL` | `=`, `contains` |
| `name` | The span's name | `=`, `contains` |
| `is_root` | Whether the span is the root of its trace (`true` or `false`) | `=` |
| `metadata` | A metadata value on the span. Requires a key. | `=`, `contains` |

**Unique user ids** and **Unique session ids** work only on rules without filters.

## When a window has no data

`count` and `uniq` read `0` on an empty window, so this setting does not apply to them. To be notified when traffic stops, alert on `count` `<` `1`.

Every other aggregation, `sum` included, is empty when the window has no spans that record the measure, such as a cost sum over spans without a cost. **When a window has no data** decides what happens:

| Mode | In the form | Behavior |
| - | - | - |
| `HOLD` (default) | Show no data, don't notify | The rule reads **No Data**. Nothing is sent and nothing clears. An alert that was already open stays open until data returns. |
| `ZERO` | Treat as zero | An empty window counts as `0` and is compared to the threshold as usual. |
| `NOTIFY` | Notify when data stops | The gap itself sends a notification, and the return of data sends another. With renotify on, the gap message repeats on the same interval. |

Under `NOTIFY`, the message goes out once the gap has lasted as long as the rule's window, or 10 minutes for longer windows.

## Renotify

Renotify controls whether a rule that stays in breach repeats its message.

* **Off (alert only on transitions)**, the default: the rule notifies only when it enters **Alert** and when it recovers.
* **Re-alert at a regular interval**: the breach message repeats every *N* minutes while the rule stays in **Alert**. The interval defaults to 60 minutes.

## Severities

The severity is the result of the latest evaluation. The list badge shows it, or the status when the rule is not active.

| Severity | Shown as | Meaning |
| - | - | - |
| `UNKNOWN` | No Data | The rule has not been evaluated yet, or was just edited or resumed. |
| `OK` | OK | The value is within the threshold. |
| `ALERT` | Alert | The value breaches the threshold. |
| `NO_DATA` | No Data | The window had nothing to measure. |

A rule whose last run failed shows **Failing** in the list, with the error. It retries on its normal schedule: next minute for a `1m` window, within 5 minutes for wider ones.

## Statuses

The status says whether the rule is being evaluated at all.

| Status | Meaning |
| - | - |
| `ACTIVE` | The rule is evaluated on schedule. |
| `PAUSED` | You stopped the rule. It is not evaluated and sends nothing until resumed. |
| `PARKED` | traceroot stopped the rule because its saved settings cannot be evaluated. |

Only traceroot sets `PARKED`, and the badge states the reason. To start a parked rule again, change the setting named in the reason and save, or resume it. A save that changes nothing, or only the name, leaves it parked. A parked rule cannot be paused.

## Starting fresh

Some actions start a rule fresh: its severity returns to **No Data** until the next evaluation, and an open alert closes. If the metric still breaches, the next evaluation announces a new alert.

Closing an open alert queues an `[OK]` message for Slack, normally within about a minute. It is only sent when Slack received the page (`[ALERT]` or `[NO_DATA]`) for the alert being closed: if its first page was still being retried, or never got through, there is nothing in the channel to close. A repeat notification that is still retrying does not hold it back, since the first page already reached the channel. It is not a recovery: it carries no measured value, and names who edited or resumed the rule. When the metric still breaches, the new `[ALERT]` follows the `[OK]`. A rule edited while paused still sends it, because the alert it closes was already announced. If Slack keeps refusing the message for about 30 minutes it is queued again, up to three more times; if no channel is set, the Slack connection is incomplete, or Slack rejected it, it is not sent again.

Deleting a rule with an alert open posts the same `[OK]` right away, naming who deleted the rule when their account has a display name, and on the same condition: only when Slack received the page (`[ALERT]` or `[NO_DATA]`) for that alert. It is sent once: if no channel is set or Slack does not accept it, it is not sent again, and the delete still goes through.

| Action | Starts fresh |
| - | - |
| Resume | Always |
| Edit filters, measure, aggregation, operator, threshold, window or no-data mode | Yes |
| Edit renotify only | No, but it restarts a parked rule |
| Rename, or save with no change | No |
| Pause | No; evaluation stops |

## Limits

* **100 alerts per project**, on every plan. Paused and parked alerts count toward the limit. The list shows how many are used once fewer than 10 are left, and **New Alert** is disabled at the limit.
* **Names** are required, up to 200 characters, and not unique: creating the same rule twice makes two rules.
* **50 filters** per rule.
* **Renotify** interval from 1 to 10,080 minutes.

## Next steps

> [card] [Introduction](https://traceroot.ai/docs/alerts/overview.md)
>
> Create your first alert and connect Slack.

> [card] [traceroot Agent](https://traceroot.ai/docs/ai-agent/overview.md)
>
> The in-app agent that can draft alerts for you.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.