@ -187,25 +187,27 @@ Annotations add metadata to provide more information on the alert in your alert
### Configure no data and error handling
Configure alerting behavior when your alert rule evaluation returns no data or an error.
In **Configure no data and error handling**, you can define the alerting behavior when the evaluation returns no data or an error.
**Note:** Alert rules that are configured to fire when an evaluation returns no data or error only fire when the entire duration of the evaluation period has finished. This means that rather than immediately firing when the alert rule condition is breached, the alert rule waits until the time set as the **For** field has finished and then fires, reducing alert noise and allowing for temporary data availability issues.
For details about alert states, refer to [lifecycle of alert instances.][alert-instance-state]
If your alert rule evaluation returns no data, you can set the state on your alert rule to appear as follows:
You can configure the alert instance state when its evaluation returns no data:
| No Data | Creates a new alert `DatasourceNoData` with the name and UID of the alert rule, and UID of the datasource that returned no data as labels. |
| Alerting | Sets alert rule state to `Alerting`. The alert rule waits until the time set in the **For** field has finished before firing. |
| No Data | The default option. Sets alert instance state to `No data`. <br/> The alert rule also creates a new alert instance `DatasourceNoData` with the name and UID of the alert rule, and UID of the datasource that returned no data as labels. |
| Alerting | Sets alert instance state to `Alerting`. It waits until the [pending period][pending-period] has finished. |
| Ok | Sets alert instance state to `Normal`. |
| Keep Last State | Maintains the alert instance in its last state. Useful for mitigating temporary issues, refer to [Keep last state][keep-last-state]. |
If your evaluation returns an error, you can set the state on your alert rule to appear as follows:
You can also configure the alert instance state when its evaluation returns an error or timeout.
| Error | Creates an alert instance `DatasourceError` with the name and UID of the alert rule, and UID of the datasource that returned no data as labels. |
| Alerting | Sets alert rule state to `Alerting`. The alert rule waits until the time set in the **For** field has finished before firing. |
| Error | The default option. Sets alert instance state to `Error`. <br/> The alert rule also creates a new alert instance `DatasourceError` with the name and UID of the alert rule, and UID of the datasource that returned no data as labels. |
| Alerting | Sets alert instance state to `Alerting`. It waits until the [pending period][pending-period] has finished. |
| Ok | Sets alert instance state to `Normal`. |
| Keep Last State | Maintains the alert instance in its last state. Useful for mitigating temporary issues, refer to [Keep last state][keep-last-state]. |
### Create alerts from panels
@ -235,4 +237,14 @@ This will open the alert rule form, allowing you to configure and create your al
| **Normal** | The state of an alert when the condition (threshold) is not met. |
| **Pending** | The state of an alert that has breached the threshold but for less than the [pending period.][pending-period] |
| **Alerting** | The state of an alert that has breached the threshold for longer than the [pending period.][pending-period] |
| **NoData** | The state of an alert whose query returns no data or all values are null. You can [change the default behavior.](/docs/grafana/latest/alerting/alerting-rules/create-grafana-managed-rule/#configure-no-data-and-error-handling) |
| **Error** | The state of an alert when an error or timeout occurred evaluating the alert rule. You can [change the default behavior.](/docs/grafana/latest/alerting/alerting-rules/create-grafana-managed-rule/#configure-no-data-and-error-handling) |
{{<figuresrc="/media/docs/alerting/alert-instance-states-v3.png"caption="Alert instance state diagram"alt="Alert instance state diagram"max-width="750px">}}
@ -54,7 +54,7 @@ Stale alert instances that are in the **Alerting**, **NoData**, or **Error** sta
The "Keep Last State" option helps mitigate temporary data source issues, preventing alerts from unintentionally firing, resolving, and re-firing.
In the alert rule settings, you can configure to keep the last state of the alert instance when a `NoData` and/or `Error` state is encountered. Just like normal evaluation, the alert instance transitions from `Pending` to `Alerting` after the pending period has elapsed.
In [Configure no data and error handling,][no-data-and-error-handling] you can decide to keep the last state of the alert instance when a `NoData` and/or `Error` state is encountered. Just like normal evaluation, the alert instance transitions from `Pending` to `Alerting` after the pending period has elapsed.