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

# Alerts

> Threshold rules on cost, latency, errors, and eval pass rate.

**Alerts** are threshold rules checked continuously against a rolling window of
your traffic. When a metric crosses its threshold, the rule starts **firing**
and sends an email. When it recovers, the rule returns to **ok** and sends a
resolve email. A rule that keeps firing re-notifies on a cooldown.

## Parts of a rule

| Field             | Description                                                                                                                                                          |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**          | Generated from the condition when you create the rule, such as `Cost above $500`. You can customize it later.                                                        |
| **Metric**        | What to measure. See the table below.                                                                                                                                |
| **Condition**     | Comparison operator: `>`, `≥`, `<`, `≤`.                                                                                                                             |
| **Threshold**     | The number the metric is compared against.                                                                                                                           |
| **Over the last** | How much recent traffic to include each time the rule is checked: 5 minutes, 15 minutes, 1 hour, or 24 hours. It is a rolling lookback, not a fixed calendar period. |
| **Notify**        | An email address to notify.                                                                                                                                          |
| **Enabled**       | Turn the rule on or off without deleting it.                                                                                                                         |

## Metrics

| Metric           | Meaning                                                                   |
| ---------------- | ------------------------------------------------------------------------- |
| `cost`           | Total cost (USD) over the selected lookback.                              |
| `latency_p95`    | p95 step latency. Entered in milliseconds.                                |
| `error_rate`     | Share of spans that errored. Entered as a percentage.                     |
| `eval_pass_rate` | Pass rate for a chosen [eval](/dashboard/evals). Entered as a percentage. |

<Note>
  Existing rules that use a legacy metric continue to run and can still be
  edited. New rules offer the four metrics above.
</Note>

## How checking works

A background job sweeps every enabled rule on an interval
(`ALERT_EVAL_INTERVAL_MS`, default 60 seconds). For each rule it computes the
metric over the window and compares it to the threshold:

* **ok to firing**: threshold crossed. Records a `fired` event with the
  observed value and threshold, and sends an email.
* **firing to ok**: metric recovered. Records a `resolved` event and sends an
  email.
* **still firing**: re-notifies at most once per `ALERT_RENOTIFY_MS` (default
  1 hour), so you aren't emailed every minute.

Each transition is stored as an alert event, so every rule has a history of
when it fired and resolved.

<Warning>
  Alert emails require email to be set up on the deployment
  (`RESEND_API_KEY`). Without it, rules still run and change state, but no
  emails are sent. See
  [self-hosting configuration](/self-hosting/configuration#email-optional).
</Warning>

## List view

The Alerts page lists every rule with its metric, condition, current value,
lookback, last evaluation, and most recent firing. A small red marker appears
beside the name only while an enabled rule is firing. Select **Edit** to change
the rule and review its recent fired and resolved history. Plans cap how many
rules an organization can create; the
[Usage](/dashboard/account#usage) panel shows your count against the limit.
