diff --git a/docs/management/alerts/create.mdx b/docs/management/alerts/create.mdx
index 5104672fc14..750747dcc5e 100644
--- a/docs/management/alerts/create.mdx
+++ b/docs/management/alerts/create.mdx
@@ -4,10 +4,6 @@ description: "Create a monitoring alert for a project, including Limits alerts."
api: "POST https://api.trigger.dev/api/v1/projects/{projectRef}/monitoring-alerts"
---
-import { PrivateBeta } from "/snippets/feature-status.jsx";
-
-
-
Authenticate with a [personal access token](/management/authentication).
## Body
diff --git a/docs/troubleshooting-alerts.mdx b/docs/troubleshooting-alerts.mdx
index fcf273c8660..7dee65882fa 100644
--- a/docs/troubleshooting-alerts.mdx
+++ b/docs/troubleshooting-alerts.mdx
@@ -1,122 +1,231 @@
---
title: "Alerts"
-description: "Get alerted when runs or deployments fail, when deployments succeed, or when you hit a limit."
+description: "Get notified by email, Slack or webhook when runs, errors, health, limits or a query need your attention. Group alerts, manage channels and replace legacy alerts."
---
-import { PrivateBeta } from "/snippets/feature-status.jsx";
+**An alert watches one thing in an environment and notifies your channels when it raises.**
-We support receiving alerts for the following events:
-- Run fails
-- Deployment fails
-- Deployment succeeds
-- A new error group appears, regresses, or is unignored
-- A limit is reached or approached
+You create and manage alerts from the **Alerts** page in the dashboard. Each alert belongs to one environment.
-The first three are created from the **Alerts** page. The fourth — an **Error group** alert — is created from the **Errors** page instead, but appears in the same Alerts table once created. It behaves quite differently from a run failure alert; see [Error group alerts](#error-group-alerts) below. The last one is a [Limits alert](#limits-alerts).
+## How alerts work
-
- If you want to be told about **every** run that fails, choose a **run fails** alert. An Error group
- alert will not do this — it deliberately stays quiet once it has alerted on a given error.
-
+An alert has one of three statuses:
-## How to setup alerts
+| Status | Meaning |
+| :-------------- | :------------------------------------------------------------------------- |
+| Active | The alert is checking its condition and nothing needs your attention. |
+| Needs attention | The alert raised and is waiting for you to mark it resolved. |
+| Inactive | The alert is not checking. It was marked inactive, or it expired. |
-
+When the condition is met, the alert **raises**: it moves to **Needs attention** and sends one notification to each of its channels. It doesn't notify again while it needs attention.
-
-Click on "Alerts" in the left hand side menu, then click on "New alert" to open the new alert modal.
-
-
+When the condition clears, the alert **recovers**. No notification is sent on any channel, and the list shows "recovered · safe to resolve". Select **Mark as Resolved** from the alert's menu to set it back to **Active**. The next raise notifies again.
-
-Choose to be notified by email, Slack notification or webhook whenever:
+## Create an alert
-- a run fails
-- a deployment fails
-- a deployment succeeds
+Click **New alert** on the Alerts page to create one alert. You pick what to watch, the condition, the channels to notify and a name. You can also set how long the alert stays active; it stops checking once it expires.
-
-
+When Ask Trigger is available, **New alert** opens these steps in the Ask Trigger panel, in **Agent** mode. Switch to **Manual** to fill them in yourself. When Ask Trigger is not available, **New alert** opens the manual steps.
-
-Click on the triple dot menu on the right side of the table row and select "Disable" or "Delete".
+An alert needs at least one [channel](#channels). You can add a channel from the channel step with **Add channel…**.
-
-
+### Ask Trigger to watch something
-
+You can also describe what you want to watch in an Ask Trigger chat, for example "make sure this task doesn't fail". Ask Trigger proposes up to three alerts.
+1. Pick the proposed alerts you want.
+2. Confirm each alert's settings, pick the channels and a name, then click **Create**.
-## Limits alerts
+## Alert types
-
+Alerts are organized by what they watch.
-A **Limits** alert watches limits that can interrupt or degrade runtime flow. Pick one limit for a single alert, or several (or "Watch all limits") for one combined alert.
+### Runs alerts
+
+| Alert | Raises when |
+| :---------------------- | :---------------------------------------------------------------- |
+| Failure rate climbing | The share of finished runs that failed crosses your threshold. |
+| Run volume changing | The number of runs triggered crosses your threshold. |
+| Runs taking too long | The p95 duration of finished runs crosses your threshold. |
+| Runs going quiet | No runs are created for the quiet window you set. |
+| Any run failing | The number of failed runs crosses your threshold. |
+
+A run counts as failed when it crashed, hit a system failure, timed out or completed with errors. Runs alerts watch one task or all runs.
+
+### Errors alerts
+
+| Alert | Raises when |
+| :------------------------- | :-------------------------------------------------- |
+| A new error appearing | An error group is seen for the first time. |
+| This error occurring again | The error group you picked occurs again. |
+
+You can also create an Errors alert from the **Errors** page with **Watch**.
+
+### Health alerts
+
+| Check | Raises when |
+| :------------------------- | :-------------------------------------------------------------------------------------------------- |
+| Flow health degrading | p95 scheduling delay or queued runs exceed their limits, or a queue has runs but none are starting. |
+| Execution health degrading | The failure rate or the p95 duration of finished runs exceeds its limit. |
+| Tasks going silent | No run has been triggered for longer than the silence limit. |
+
+Pick one check, or several for one combined alert. Each check has thresholds you can change.
+
+### Queues alerts
+
+| Alert | Raises when |
+| :--------------------------- | :--------------------------------------------------------------------------------- |
+| Depth getting too high | The peak number of runs waiting in a queue crosses your threshold. |
+| Oldest run waiting too long | The oldest run still waiting in a queue has waited longer than your threshold. |
+| Concurrency usage spiking | The share of a queue's concurrency limit in use crosses your threshold. |
+| A queue stalling | A queue has runs waiting but none started. |
+| Scheduling delay climbing | The p95 time between a run being queued and starting crosses your threshold. |
+
+Queues alerts watch one queue, queues matching a pattern such as `worker-*`, or all queues. To start one for a specific queue, click **Watch** on the queue's page, or select **Watch…** from the queue's menu in the queue list.
+
+If you self-host Trigger.dev, Queues alerts need queue metrics enabled on your instance.
-| Group | What you can watch |
-| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| Platform | API rate limit running out, Environment concurrency filling up, Queue size nearing its limit |
-| Webhooks | Webhook processing saturating, Webhook ingress getting rate-limited, Webhook endpoint getting rate-limited, Webhook waiters running out |
+### Limits alerts
-### Signals
+A **Limits** alert watches limits that can interrupt or degrade runtime flow. Pick one limit for a single alert, or several (or "Watch all limits") for one combined alert.
+
+| Group | What you can watch |
+| -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
+| Platform | API rate limit running out, Environment concurrency filling up, Queue size nearing its limit |
+| Webhooks | Webhook processing saturating, Webhook ingress getting rate-limited, Webhook endpoint getting rate-limited, Webhook waiters running out |
-Each limit has up to two signals. Choose one or both:
+Each limit has up to two signals:
- **Limit reached**: the limit is already affecting traffic, for example requests are being rejected.
- **Approaching the limit**: usage has reached a share of the limit. The default is 80%, and you can change it.
-Queue size only has the approaching signal.
+Queue size and Webhook processing only have the approaching signal.
-### Any or all
+When you watch more than one limit, choose **Raise when any** to raise when at least one selected limit fires, or **Raise when all** to raise only when every selected limit fires at the same time.
-When you watch more than one limit, choose when the alert raises:
+If you self-host Trigger.dev, Environment concurrency and Queue size need queue metrics enabled on your instance.
-- **Any**: raise when at least one selected limit is true.
-- **All**: raise only when every selected limit is true at the same time.
+A limit shows "No data" until its metrics exist, for example before your environment has made any API requests or received any webhooks. You can query these metrics yourself, see [Platform limit metrics](/observability/query#platform-limit-metrics).
-### Queue metrics
+You can also create Limits alerts with the [API](/management/alerts/create).
-Environment concurrency and queue size need queue metrics for your environment. If they aren't available, they aren't offered when you create the alert.
+### Query alerts
-### No data
+A Query alert watches the result of a [query](/observability/query). It appears as **Custom** in the Watching column of the alerts list. You start one with **Watch**, not from **New alert**:
-A limit shows "No data" until its metrics exist, for example before your environment has made any API requests or received any webhooks. You can query these metrics yourself, see [Platform limit metrics](/observability/query#platform-limit-metrics).
+- On the **Query** page, run a query and click **Watch**.
+- On a [dashboard](/observability/dashboards), open a widget's menu and select **Watch**.
+
+Then choose when it fires:
+
+| Condition | Raises when |
+| :--------------------------------- | :-------------------------------------------------------- |
+| Value crosses a threshold | The value you picked goes above or below your threshold. |
+| New matching results appear | The query returns rows it hasn't returned before. |
+| No matching results for the window | The query returns no rows for the window you set. |
+
+Only the conditions that fit the query are offered. If a query can't be used for an alert, **Watch** is disabled and shows why.
+
+## Groups
+
+A group combines alerts into one alert with its own channels.
+
+1. On the Alerts page, select two or more alerts.
+2. Click **Group N alerts** in the bar at the bottom of the list.
+3. Choose **Raise when any** or **Raise when all**, pick the group's channels and a name, then click **Create group**.
+
+Alerts in a group keep checking their conditions, but they notify only through the group. An alert can be in one group at a time, and a group can't contain another group. Only active alerts can be grouped.
+
+To split a group, select **Ungroup** from the group's menu. The group is deleted and its alerts notify on their own again.
+
+## Manage alerts
-You can also create these alerts with the [API](/management/alerts/create).
+Open an alert's menu on the Alerts page:
-## Error group alerts
+- **Edit**: change the alert's settings, channels or expiry.
+- **Mark as Resolved**: shown when the alert needs attention.
+- **Mark as Inactive**: stop checking the alert.
+- **Activate**: start checking an inactive alert again.
+- **Delete**: shown for inactive alerts. Mark an alert inactive first to delete it.
-Error group alerts are **issue-based**, not run-based. They are created from the **Errors** page in the dashboard (the "Configure alerts…" button), not from the New alert modal on the Alerts page. Once created they show up in the Alerts table alongside your other alerts, labelled "Error group".
+## Channels
-An error group is one distinct error — the same error from many runs is a single group, with a status of **Unresolved**, **Resolved** or **Ignored** that you set from the Errors page.
+A channel is where an alert sends its notifications. To open the channel list, click the **⋮** menu next to **New alert** on the Alerts page and select **Channels**.
-### When an error group alert fires
+### Add a channel
-The alert only fires when a group's status *changes* in one of these three ways:
+Click **Add channel**, choose the type, fill in its details and click **Save**:
-| Trigger | Meaning |
-| :------ | :------ |
-| New issue | The error has been seen for the first time. |
-| Regression | The group was marked **Resolved**, and the error has occurred again since. |
-| Unignored | The group was **Ignored**, and the ignore condition you set has been breached. |
+| Type | What it needs |
+| :------ | :---------------------------------------------------------------------------------- |
+| Email | An email address. |
+| Slack | A Slack channel. Click **Connect to Slack** first if your workspace isn't connected. |
+| Webhook | A URL. We send `POST` requests to it with a JSON payload. |
-### Why it goes quiet
+To send alerts to a private Slack channel, invite the Trigger.dev bot: in the Slack channel, type `/invite @Trigger.dev`.
-This is the part that surprises people, so it is worth stating plainly:
+The webhook secret is shown next to the webhook channel in the channel list. Use it to [verify the payload](#alert-webhooks).
-**An Unresolved error group does not alert.** After an error group alert fires, the group is set to Unresolved, and it stays silent no matter how many more times that error occurs. It will only alert again once you mark it **Resolved** (and it then recurs) or **Ignored** (and the ignore condition is breached).
+The number of channels a project can have depends on your plan. See [Alerts limits](/limits#alerts).
-This is intentional — one persistently broken task should not flood your Slack channel with a message per failed run. But it means an Error group alert is not a substitute for a run failure alert. If a task has been failing in production for days and you have had no notification, check whether the only alert you have configured is an Error group alert whose group is sitting at Unresolved.
+### Enable, disable, edit or delete a channel
-### Which alert type should I use?
+Open the channel's menu in the channel list:
-- **"Tell me about every run that fails"** → a **run fails** alert, from the Alerts page. It fires for every run that fails once its retries are exhausted.
-- **"Tell me when something new breaks"** → an **Error group** alert, from the Errors page.
+- **Disable** stops the channel receiving notifications. **Enable** turns it back on.
+- **Edit** changes the channel's details and the environments it's used in. You can't change its type.
+- **Delete** removes the channel.
-The two are complementary, and many teams want both.
+The channel step of an alert only lists channels enabled for that alert's environment. If an alert uses a channel that is disabled or deleted, the alert's page flags it. Edit the alert's channels to fix it.
+
+## Legacy alerts
+
+Alerts created before the current Alerts continue to work. To see them, click the **⋮** menu next to **New alert** and select **Legacy alerts**. The menu item only appears when you have legacy alerts. Each row shows the channel, the alert type and its environments.
+
+### Legacy alerts and their new equivalents
+
+| Legacy alert | New alert | Replace with new Alert |
+| :------------------- | :------------------------------------------------ | :--------------------- |
+| Task run failure | Any run failing (Runs) | Yes |
+| Task attempt failure | None | Coming soon |
+| Deployment failure | None | Coming soon |
+| Deployment success | None | Coming soon |
+| Error group | A new error appearing, This error occurring again | Not listed |
+
+**Any run failing** behaves differently from a Task run failure alert. It doesn't send one notification per failed run. It raises when the number of failed runs crosses its threshold, notifies once, and stays quiet until you mark it resolved.
+
+Error group alerts created earlier from the **Errors** page aren't listed under Legacy alerts and can't be replaced. They keep working. To watch errors with the new alerts, create an [Errors alert](#errors-alerts).
+
+### Replace a legacy alert
+
+**Task run failure** legacy alerts can be replaced with a new alert:
+
+1. Click **Replace with new Alert** on the row. The channel must be enabled.
+2. Pick the environments to watch. Replace creates one **Any run failing** alert per environment.
+3. Confirm the settings and channels, then create the alerts. The legacy channel is preselected.
+
+After the replacement, the new alerts appear on the Alerts page. Task run failure is removed from the legacy channel. The channel itself stays, with any other legacy alert types it has.
+
+If the channel is a webhook, it now receives `alert.raised` payloads instead of `alert.run.failed`. Update your webhook handler to handle the new type, see [Alert webhooks](#alert-webhooks).
+
+**Task attempt failure**, **Deployment failure** and **Deployment success** legacy alerts show a "Coming soon" badge and can't be replaced. They keep working.
+
+### Delete a legacy alert
+
+Open the row's menu, select **Delete** and confirm. This removes that alert type from the channel.
## Alert webhooks
+Each webhook payload has a `type`:
+
+| Sent by | `type` |
+| :------------------------------- | :------------------------------------------------------------------------------ |
+| New alerts, including groups | `alert.raised` |
+| Legacy alerts | `alert.run.failed`, `alert.deployment.success`, `alert.deployment.failed` |
+| Error group alerts | `alert.error` |
+
+New alerts send a webhook only when they raise.
+
For the alert webhooks you can use the SDK to parse them. Here is an example of how to parse the webhook payload in Remix:
```ts
@@ -131,7 +240,7 @@ export async function action({ request }: ActionFunctionArgs) {
try {
// Construct and verify the webhook event
- // This secret can be found on your Alerts page when you create a webhook alert
+ // Copy this secret from the webhook channel in the channel list
const event = await webhooks.constructEvent(request, process.env.ALERT_WEBHOOK_SECRET!);
// Process the event based on its type
@@ -187,7 +296,7 @@ export async function action({ request }: ActionFunctionArgs) {
### Common properties
-When you create a webhook alert, you'll receive different payloads depending on the type of alert. All webhooks share some common properties:
+The payload depends on the `type`. All webhooks share these properties:
A unique identifier for this webhook event
@@ -207,7 +316,7 @@ When you create a webhook alert, you'll receive different payloads depending on
### Run Failed Alert
-This webhook is sent when a run fails. The payload is available on the `object` property:
+This webhook is sent by legacy Task run failure alerts when a run fails. The payload is available on the `object` property:
Unique identifier for the task
@@ -218,7 +327,7 @@ This webhook is sent when a run fails. The payload is available on the `object`
- Name of the exported task function
+ Name of the exported task function (optional)
@@ -331,7 +440,7 @@ This webhook is sent when a run fails. The payload is available on the `object`
### Deployment Success Alert
-This webhook is sent when a deployment succeeds. The payload is available on the `object` property:
+This webhook is sent by legacy Deployment success alerts. The payload is available on the `object` property:
Deployment ID
@@ -369,6 +478,10 @@ This webhook is sent when a deployment succeeds. The payload is available on the
Environment slug
+
+ Environment branch name (optional)
+
+
Organization ID
@@ -447,7 +560,7 @@ This webhook is sent when a deployment succeeds. The payload is available on the
### Deployment Failed Alert
-This webhook is sent when a deployment fails. The payload is available on the `object` property:
+This webhook is sent by legacy Deployment failure alerts. The payload is available on the `object` property:
Deployment ID
@@ -497,6 +610,10 @@ This webhook is sent when a deployment fails. The payload is available on the `o
Environment slug
+
+ Environment branch name (optional)
+
+
Organization ID
@@ -575,7 +692,7 @@ This webhook is sent when a deployment fails. The payload is available on the `o
### Error Group Alert
-This webhook is sent for an [error group alert](#error-group-alerts). The payload is available on the `object` property:
+This webhook is sent by error group alerts. The payload is available on the `object` property:
Why the alert fired. One of: `new_issue`, `regression`, `unignored`
@@ -597,11 +714,11 @@ This webhook is sent for an [error group alert](#error-group-alerts). The payloa
Sample stack trace, if available
-
+
When the error was first seen
-
+
When the error was last seen
@@ -655,9 +772,9 @@ This webhook is sent for an [error group alert](#error-group-alerts). The payloa
### Alert Raised
-This webhook is sent when a [Limits alert](#limits-alerts) raises. The payload is available on the `object` property.
+This webhook is sent when a new alert or group raises and notifies, not when it recovers or raises again before you mark it resolved. The payload is available on the `object` property.
-Use `@trigger.dev/sdk` 4.9.2 or later. Older versions don't have the `alert.raised` type, and `webhooks.constructEvent` throws a `WebhookError` for this webhook.
+Verifying `alert.raised` with `webhooks.constructEvent` needs an up-to-date `@trigger.dev/sdk`. Older versions throw a `WebhookError` for this type, so update the SDK.
Alert ID
@@ -668,7 +785,7 @@ Use `@trigger.dev/sdk` 4.9.2 or later. Older versions don't have the `alert.rais
- What the alert watches, for example `limits.api` or `limits.all`
+ What the alert watches, for example `runs.failed`, `limits.all` or `custom.query`
@@ -688,7 +805,7 @@ Use `@trigger.dev/sdk` 4.9.2 or later. Older versions don't have the `alert.rais
- One-line summary of the event. Only set for some alerts.
+ One-line summary of the event. Only set for Query alerts.