- Queries and expressions that select the data set to evaluate.
- A condition (the threshold) that the query must meet or exceed to trigger the alert instance.
- An interval that specifies the frequency of [alert rule evaluation][alert-rule-evaluation] and a duration indicating how long the condition must be met to trigger the alert instance.
- Other customizable options, for example, setting what should happen in the absence of data, notification messages, and more.
Grafana-managed alert rules are the most flexible alert rule type. They allow you to create alerts that can act on data from any of the [supported data sources](#supported-data-sources), and use multiple data sources in a single alert rule.
Additionally, you can also add [expressions to transform your data][expression-queries], set custom alert conditions, and include [images in alert notifications][notification-images].
{{<figuresrc="/media/docs/alerting/grafana-managed-alerting-architecture.png"max-width="750px"caption="How Grafana-managed alerting works by default">}}
Grafana-managed alert rules can query backend data sources if Grafana Alerting is enabled by specifying `{"backend": true, "alerting": true}` in the [plugin.json](/developers/plugin-tools/reference-plugin-json).
Data source-managed alert rules can improve query performance via [recording rules](#recording-rules) and ensure high-availability and fault tolerance when implementing a distributed architecture.
They are only supported for Prometheus-based or Loki data sources with the Ruler API enabled. For more information, refer to the [Loki Ruler API](/docs/loki/<GRAFANA_VERSION>/api/#ruler) or [Mimir Ruler API](/docs/mimir/<GRAFANA_VERSION>/references/http-api/#ruler).
A recording rule allows you to pre-compute frequently needed or computationally expensive expressions and save their result as a new set of time series. This is useful if you want to run alerts on aggregated data or if you have dashboards that query computationally expensive expressions repeatedly.
Querying this new time series is faster, especially for dashboards since they query the same expression every time the dashboards refresh. For more information, refer to [Create recording rules][create-recording-rules].
| Create alert rules<wbr/> based any [supported data sources](#supported-data-sources) | Yes | No. Only Prometheus-based or Loki data sources. |
| Mix and match data sources | Yes | No |
| Add [expressions][expression-queries] to transform<wbr/> queried data and set alert conditions | Yes | No |
| Use [images in alert notifications][notification-images] | Yes | No |
| Create [recording rules](#recording-rules) | No | Yes |
| Support for [inhibition rules](https://prometheus.io/docs/alerting/latest/configuration/#inhibition-related-settings) | No | Yes |
| Alert rule storage and evaluation | Within Grafana | Within the data source |
| Alert delivery | Alerts are sent to either the [Grafana Alertmanager or an external Alertmanager][alert-manager]. | Alerts from the data source are sent to the Alertmanager configured in the data source. |
| Scalability | More resource-intensive as it depends on the Grafana instance and its database. It only scales vertically. | Evaluate and generate alerts from the data source. A distributed architecture allows for horizontal scaling. |