<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configure alert rules on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/</link><description>Recent content in Configure alert rules on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.3/alerting/alerting-rules/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure Grafana-managed alert rules</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/create-grafana-managed-rule/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/create-grafana-managed-rule/</guid><content><![CDATA[

&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Pre-provisioned Loki and Prometheus data source-managed alerts have been deprecated in Grafana Cloud and can not be created in new stacks.
New Grafana Cloud stacks will use Grafana-managed alerting (GMA) by default. Datasource-managed alerting (DMA) is not provisioned in new stacks. Existing stacks are not affected.&lt;/p&gt;
&lt;p&gt;This applies to the default Loki and Prometheus Grafana Cloud data sources managed by Grafana Labs and Cloud Alertmanager, which will not be available nor will Grafana provision the data source for it. If you add your own Mimir, Loki, or Alertmanager data sources, you can continue to use data source-managed alerts.&lt;/p&gt;
&lt;p&gt;Cloud users can import DMA rules into GMA rules with the import tool. See the &lt;a href=&#34;/docs/grafana/latest/alerting/alerting-rules/alerting-migration/&#34;&gt;import data source-managed alerts to Grafana-managed alerts documentation&lt;/a&gt; for information on how to do this.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h1 id=&#34;configure-grafana-managed-alert-rules&#34;&gt;Configure Grafana-managed alert rules&lt;/h1&gt;
&lt;p&gt;Grafana-managed alert rules are the default way to create alert rules in Grafana.&lt;/p&gt;
&lt;p&gt;Grafana-managed rules inherit their model from Prometheus Alerting and extend it with greater flexibility—such as multi-data source queries, expression-based transformations, advanced alert conditions, images in notifications, custom states, and more.&lt;/p&gt;
&lt;p&gt;To create or edit Grafana-managed alert rules, follow the instructions below.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;For quick-start tutorials on key alerting features, see 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/best-practices/tutorials/&#34;&gt;Getting started with Grafana Alerting tutorials&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you create Grafana-managed alert rules, review the following requirements and options.&lt;/p&gt;
&lt;h3 id=&#34;supported-data-sources&#34;&gt;Supported data sources&lt;/h3&gt;
&lt;p&gt;Grafana-managed alert rules can query backend data sources when the data source&amp;rsquo;s &lt;code&gt;plugin.json&lt;/code&gt; file sets &lt;code&gt;{&amp;quot;backend&amp;quot;: true, &amp;quot;alerting&amp;quot;: true}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Before you create an alert rule, verify that the data sources you plan to query are compatible and properly configured.&lt;/p&gt;
&lt;p&gt;You can find the public data sources that support alert rules in the &lt;a href=&#34;/grafana/plugins/data-source-plugins/?features=alerting&#34;&gt;Grafana Plugins directory&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;alert-rule-limits-in-grafana-cloud&#34;&gt;Alert rule limits in Grafana Cloud&lt;/h3&gt;
&lt;p&gt;In Grafana Cloud, the number of Grafana-managed alert rules you can create depends on your Grafana Cloud plan.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Free Forever plan: You can create up to 500 free alert rules, with each alert rule having a maximum of 1000 alert instances.&lt;/li&gt;
&lt;li&gt;All paid plans: They have a soft limit of 2000 alert rules and support unlimited alert instances. To increase the limit, open a support ticket from the &lt;a href=&#34;/docs/grafana-cloud/account-management/support/&#34;&gt;Cloud portal&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;permissions&#34;&gt;Permissions&lt;/h3&gt;
&lt;p&gt;Only users with &lt;strong&gt;Edit&lt;/strong&gt; permissions for the folder storing the rules can edit or delete Grafana-managed alert rules. Only admins can restore deleted Grafana-managed alert rules.&lt;/p&gt;
&lt;h3 id=&#34;provisioning&#34;&gt;Provisioning&lt;/h3&gt;
&lt;p&gt;Note that if you delete an alert resource created in the UI, you can no longer retrieve it.&lt;/p&gt;
&lt;p&gt;To backup and manage alert rules, you can 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/provision-alerting-resources/&#34;&gt;provision alerting resources&lt;/a&gt; using options such as configuration files, Terraform, or the Alerting API.&lt;/p&gt;
&lt;h3 id=&#34;default-versus-advanced-options&#34;&gt;Default versus Advanced options&lt;/h3&gt;
&lt;p&gt;Grafana Alerting provides multiple configuration options to support different alerting needs.&lt;/p&gt;
&lt;p&gt;To simplify alert rule creation, some settings display a &lt;strong&gt;Default&lt;/strong&gt; and an &lt;strong&gt;Advanced&lt;/strong&gt; configuration view:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#define-query-and-condition&#34;&gt;Define query and condition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#configure-notifications&#34;&gt;Configure notifications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use &lt;strong&gt;Default&lt;/strong&gt; to create basic query conditions and route alerts directly to a contact point. Use &lt;strong&gt;Advanced&lt;/strong&gt; for more complex query definitions, or to route alerts using notification policies.&lt;/p&gt;
&lt;p&gt;You can switch between options at any time. After you create an alert rule, Grafana remembers your last selection and uses it as the default for the next rule.&lt;/p&gt;
&lt;h2 id=&#34;set-alert-rule-name&#34;&gt;Set alert rule name&lt;/h2&gt;


&lt;div data-shared=&#34;alerts/configure-alert-rule-name.md&#34;&gt;
            &lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Alerts &amp;amp; IRM&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt; -&amp;gt; &lt;strong&gt;&#43; New alert rule&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a name to identify your alert rule.&lt;/p&gt;
&lt;p&gt;This name is displayed in the alert rule list. It is also the &lt;code&gt;alertname&lt;/code&gt; label for every alert instance that is created from this rule.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

        
&lt;h2 id=&#34;define-query-and-condition&#34;&gt;Define query and condition&lt;/h2&gt;
&lt;p&gt;Define a query to get the data you want to measure and a condition that needs to be met before an alert rule fires.&lt;/p&gt;
&lt;p&gt;Depending on the data source, the query editor offers a &lt;strong&gt;Builder&lt;/strong&gt; and a &lt;strong&gt;Code&lt;/strong&gt; option. &lt;strong&gt;Builder&lt;/strong&gt; helps you construct a query with a visual interface. The &lt;strong&gt;Builder&lt;/strong&gt; option is useful if you have limited experience with the query language, while &lt;strong&gt;Code&lt;/strong&gt; lets you write the query directly for more control. Switch between them using the &lt;strong&gt;Builder&lt;/strong&gt; and &lt;strong&gt;Code&lt;/strong&gt; tabs on the query editor toolbar.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Default&lt;/strong&gt; option allows you to configure one query and one alert condition. The &lt;strong&gt;Advanced&lt;/strong&gt; option allows you to use multiple queries and expressions for more complex rule definitions.&lt;/p&gt;
&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Default options&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a data source.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/&#34;&gt;query&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add an 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/#alert-condition&#34;&gt;alert condition&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;When&lt;/strong&gt; input includes the reducer function and the last input is the threshold.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Preview&lt;/strong&gt; to verify.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Advanced options&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a data source.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From the &lt;strong&gt;Options&lt;/strong&gt; drop-down menu, specify a 
    &lt;a href=&#34;/docs/grafana/v13.3/visualizations/dashboards/use-dashboards/#time-units-and-relative-ranges&#34;&gt;time range&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that Grafana Alerting only supports fixed relative time ranges, for example, &lt;code&gt;now-24hr: now&lt;/code&gt;.
It doesn&amp;rsquo;t support absolute time ranges: &lt;code&gt;2021-12-02 00:00:00 to 2021-12-05 23:59:592&lt;/code&gt; or semi-relative time ranges: &lt;code&gt;now/d to: now&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a query.&lt;/p&gt;
&lt;p&gt;To add multiple 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/&#34;&gt;queries&lt;/a&gt;, click &lt;strong&gt;Add query&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;All alert rules are managed by Grafana by default. If you want to switch to a data source-managed alert rule, click &lt;strong&gt;Switch to data source-managed alert rule&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add one or more 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/#expression-queries&#34;&gt;expressions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;a. For each expression, select either &lt;strong&gt;Classic condition&lt;/strong&gt; to create a single alert rule, or choose from the &lt;strong&gt;Math&lt;/strong&gt;, &lt;strong&gt;Reduce&lt;/strong&gt;, and &lt;strong&gt;Resample&lt;/strong&gt; options to generate separate alert for each series.&lt;/p&gt;
&lt;p&gt;When using Prometheus, you can use an instant vector and built-in functions, so you don&amp;rsquo;t need to add additional expressions.&lt;/p&gt;
&lt;p&gt;b. Click &lt;strong&gt;Preview&lt;/strong&gt; to verify that the expression is successful.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To add a 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/#recovery-threshold&#34;&gt;recovery threshold&lt;/a&gt;, enable the &lt;strong&gt;Custom recovery threshold&lt;/strong&gt; toggle and enter a value that defines when the alert should recover—transition to &lt;code&gt;Normal&lt;/code&gt; state from the &lt;code&gt;Alerting&lt;/code&gt; or &lt;code&gt;Pending&lt;/code&gt; state.&lt;/p&gt;
&lt;p&gt;You can only add one recovery threshold, and it must be part of the alert condition.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Set as alert condition&lt;/strong&gt; on the query or expression you want to set as your 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/#alert-condition&#34;&gt;alert condition&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You can switch between &lt;strong&gt;Default&lt;/strong&gt; and &lt;strong&gt;Advanced&lt;/strong&gt; options at any time.&lt;/p&gt;
&lt;p&gt;Switching from &lt;strong&gt;Advanced&lt;/strong&gt; to &lt;strong&gt;Default&lt;/strong&gt; may result in queries and expressions that can&amp;rsquo;t be converted. In this case, a warning message asks if you want to continue to reset to default settings.&lt;/p&gt;
&lt;p&gt;If the &lt;a href=&#34;#default-versus-advanced-options&#34;&gt;Default versus Advanced options&lt;/a&gt; feature is not enabled in your Grafana instance, follow the &lt;strong&gt;Advanced options&lt;/strong&gt; instructions.&lt;/p&gt;
&lt;h2 id=&#34;set-folder-and-labels&#34;&gt;Set folder and labels&lt;/h2&gt;
&lt;p&gt;Organize your alert rule with a folder and set of labels.&lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;Labels&lt;/strong&gt; section, you can optionally choose whether to add labels to organize your alert rules and their notifications. For more details, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#labels&#34;&gt;alert rule labels&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a folder or click &lt;strong&gt;&#43; New folder&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add labels, if required.&lt;/p&gt;
&lt;p&gt;Add custom labels by selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;configure-alert-evaluation-behavior&#34;&gt;Configure alert evaluation behavior&lt;/h2&gt;
&lt;p&gt;Use 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/&#34;&gt;alert rule evaluation&lt;/a&gt; to determine how frequently an alert rule should be evaluated and how quickly it should change its state.&lt;/p&gt;
&lt;p&gt;To do this, you need to make sure that your alert rule is in the right evaluation group and set a pending period time that works best for your use case.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select an evaluation group or click &lt;strong&gt;&#43; New evaluation group&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you are creating a new evaluation group, specify the interval for the group.&lt;/p&gt;
&lt;p&gt;All rules within the same group are evaluated concurrently over the same time interval.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/#pending-period&#34;&gt;pending period&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The pending period is the period in which an alert rule can be in breach of the condition until it fires.&lt;/p&gt;
&lt;p&gt;After a condition is met, the alert goes into the &lt;strong&gt;Pending&lt;/strong&gt; state.
If the condition remains active for the duration specified, the alert transitions to the &lt;strong&gt;Firing&lt;/strong&gt; state, else it reverts to the &lt;strong&gt;Normal&lt;/strong&gt; state.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optionally, set the 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/#keep-firing-for&#34;&gt;Keep firing for&lt;/a&gt; period.&lt;/p&gt;
&lt;p&gt;You can set the minimum amount of time that an alert remains firing after the breached threshold expression no longer returns any results. This sets an alert to a &amp;ldquo;Recovering&amp;rdquo; state for the duration of time set here. The Recovering state can be used to reduce noise from flapping alerts. Select &amp;ldquo;none&amp;rdquo; to stop an alert from firing immediately after the breach threshold is cleared.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn on pause alert notifications, if required.&lt;/p&gt;
&lt;p&gt;You can pause alert rule evaluation to prevent noisy alerting while tuning your alerts.
Pausing stops alert rule evaluation and doesn&amp;rsquo;t create any alert instances.
This is different from 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/mute-timings/&#34;&gt;mute timings&lt;/a&gt;, which stop notifications from being delivered, but still allow for alert rule evaluation and the creation of alert instances.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Configure no data and error handling&lt;/strong&gt;, you can define the alerting behavior and alerting state for two scenarios:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When the evaluation returns &lt;strong&gt;No data&lt;/strong&gt; or all values are null.&lt;/li&gt;
&lt;li&gt;When the evaluation returns &lt;strong&gt;Error&lt;/strong&gt; or timeout.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;configure-no-data-and-error-handling&#34;&gt;Configure no data and error handling&lt;/h3&gt;
&lt;p&gt;Configure the behavior when the evaluation returns no data:&lt;/p&gt;

   
   &lt;div data-shared=&#34;alerts/modify-nodata-state.md&#34;&gt;
               &lt;ul&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Set No Data state&lt;/strong&gt; (Default)&lt;/p&gt;
   &lt;p&gt;If the pending period is &lt;code&gt;0&lt;/code&gt;, the alert instance transitions immediately to &lt;strong&gt;No Data&lt;/strong&gt;. Otherwise, it transitions to the &lt;strong&gt;Pending&lt;/strong&gt; state, and then to &lt;strong&gt;No Data&lt;/strong&gt; after the pending period has elapsed and the last evaluation returns no data.&lt;/p&gt;
   &lt;p&gt;When entering the &lt;strong&gt;No Data&lt;/strong&gt; state, the alert rule creates a new &lt;code&gt;DatasourceNoData&lt;/code&gt; alert instance with labels for the alert rule name, UID, and data source UID.&lt;/p&gt;
   &lt;/li&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Set Alerting state&lt;/strong&gt;&lt;/p&gt;
   &lt;p&gt;If the pending period is &lt;code&gt;0&lt;/code&gt;, the alert instance transitions immediately to &lt;strong&gt;Alerting&lt;/strong&gt;. Otherwise, it transitions to the &lt;strong&gt;Pending&lt;/strong&gt; state, and then to &lt;strong&gt;Alerting&lt;/strong&gt; after the pending period has elapsed and the last evaluation returns no data or a threshold breach.&lt;/p&gt;
   &lt;/li&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Set Normal state&lt;/strong&gt;&lt;/p&gt;
   &lt;p&gt;The alert instance transitions immediately to the &lt;strong&gt;Normal&lt;/strong&gt; state.&lt;/p&gt;
   &lt;/li&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Keep last state&lt;/strong&gt;&lt;/p&gt;
   &lt;p&gt;The alert instance keeps its current state.&lt;/p&gt;
   &lt;/li&gt;
   &lt;/ul&gt;
   &lt;/div&gt;
   
           
&lt;p&gt;You can also configure the behavior when the evaluation returns an error:&lt;/p&gt;

   
   &lt;div data-shared=&#34;alerts/modify-error-state.md&#34;&gt;
               &lt;ul&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Set Error state&lt;/strong&gt; (Default)&lt;/p&gt;
   &lt;p&gt;If the pending period is &lt;code&gt;0&lt;/code&gt;, the alert instance transitions immediately to &lt;strong&gt;Error&lt;/strong&gt;. Otherwise, it transitions to the &lt;strong&gt;Pending&lt;/strong&gt; state, and then to &lt;strong&gt;Error&lt;/strong&gt; after the pending period has elapsed and the last evaluation returns an error.&lt;/p&gt;
   &lt;p&gt;When entering the &lt;strong&gt;Error&lt;/strong&gt; state, the alert rule creates a new &lt;code&gt;DatasourceError&lt;/code&gt; alert instance with labels for the alert rule name, UID, and data source UID.&lt;/p&gt;
   &lt;/li&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Set Alerting state&lt;/strong&gt;&lt;/p&gt;
   &lt;p&gt;If the pending period is &lt;code&gt;0&lt;/code&gt;, the alert instance transitions immediately to &lt;strong&gt;Alerting&lt;/strong&gt;. Otherwise, it transitions to the &lt;strong&gt;Pending&lt;/strong&gt; state, and then to &lt;strong&gt;Alerting&lt;/strong&gt; after the pending period has elapsed and the last evaluation returns an error or a threshold breach.&lt;/p&gt;
   &lt;/li&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Set Normal state&lt;/strong&gt;&lt;/p&gt;
   &lt;p&gt;The alert instance transitions immediately to the &lt;strong&gt;Normal&lt;/strong&gt; state.&lt;/p&gt;
   &lt;/li&gt;
   &lt;li&gt;
   &lt;p&gt;&lt;strong&gt;Keep last state&lt;/strong&gt;&lt;/p&gt;
   &lt;p&gt;The alert instance keeps its current state.&lt;/p&gt;
   &lt;/li&gt;
   &lt;/ul&gt;
   &lt;/div&gt;
   
           
&lt;p&gt;For more details, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/stale-alert-instances/&#34;&gt;alert instance states&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/nodata-and-error-states/#modify-the-no-data-or-error-state&#34;&gt;modify the no data or error state&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Configure no data and error handling&lt;/strong&gt;, you can also configure 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/stale-alert-instances/#configure-missing-series-evaluations-to-resolve&#34;&gt;Missing series evaluations to resolve&lt;/a&gt;: how many consecutive evaluation intervals must pass without data before an alert instance is considered stale.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;configure-notifications&#34;&gt;Configure notifications&lt;/h2&gt;
&lt;p&gt;Configure who receives notifications when the alert rule fires.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Default&lt;/strong&gt; option allows you to select a 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/notifications/contact-points/&#34;&gt;contact point&lt;/a&gt; to handle notifications for this alert rule. The &lt;strong&gt;Advanced&lt;/strong&gt; option routes notifications through 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/notifications/notification-policies/&#34;&gt;notification policies&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Default options&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select an existing 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/notifications/contact-points/&#34;&gt;contact point&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All notifications for this alert rule are sent to this contact point automatically and notification policies aren&amp;rsquo;t used.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optionally, configure additional notification settings like grouping or timing options.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Advanced options&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;&lt;p&gt;With this option, all notifications for this alert rule are managed by the 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/notifications/notification-policies/&#34;&gt;notification policy tree&lt;/a&gt;, which routes alerts based on their labels.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Change&lt;/strong&gt; to change the routing from the default policy to another policy.&lt;/p&gt;
&lt;p&gt;You can preview which notification policy would handle notifications from this alert rule.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Preview routing&lt;/strong&gt; after configuring the previous alert rule settings.&lt;/p&gt;
&lt;p&gt;Based on the alert labels and query labels, Grafana displays the notification policies that would handle the notifications.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;View route&lt;/strong&gt; to view policy and routing details.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You can switch between &lt;strong&gt;Default&lt;/strong&gt; and &lt;strong&gt;Advanced&lt;/strong&gt; options at any time.&lt;/p&gt;
&lt;p&gt;If the &lt;a href=&#34;#default-versus-advanced-options&#34;&gt;Default versus Advanced options&lt;/a&gt; feature is not enabled in your Grafana instance, follow the &lt;strong&gt;Advanced options&lt;/strong&gt; instructions.&lt;/p&gt;
&lt;h2 id=&#34;configure-notification-message&#34;&gt;Configure notification message&lt;/h2&gt;
&lt;p&gt;Use 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#annotations&#34;&gt;annotations&lt;/a&gt; to add information to alert messages that can help respond to the alert.&lt;/p&gt;
&lt;p&gt;Annotations are included by default in notification messages, and can use text or 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/templates/&#34;&gt;templates&lt;/a&gt; to display dynamic data from queries.&lt;/p&gt;
&lt;p&gt;Grafana provides several optional annotations.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a summary.&lt;/p&gt;
&lt;p&gt;Short summary of what happened and why.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a description.&lt;/p&gt;
&lt;p&gt;Description of what the alert rule does.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a Runbook URL.&lt;/p&gt;
&lt;p&gt;Webpage where you keep your runbook for the alert&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a custom annotation.&lt;/p&gt;
&lt;p&gt;Add any additional information that could help address the alert.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: &lt;strong&gt;Link dashboard and panel&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/link-alert-rules-to-panels/&#34;&gt;Link the alert rule to a panel&lt;/a&gt; to facilitate alert investigation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save rule&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>Pre-provisioned Loki and Prometheus data source-managed alerts have been deprecated in Grafana Cloud and can not be created in new stacks.
New Grafana Cloud stacks will use Grafana-managed alerting (GMA) by default. Datasource-managed alerting (DMA) is not provisioned in new stacks. Existing stacks are not affected.&lt;/p></description></item><item><title>Create and link alert rules to panels</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/link-alert-rules-to-panels/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/link-alert-rules-to-panels/</guid><content><![CDATA[&lt;h1 id=&#34;create-and-link-alert-rules-to-panels&#34;&gt;Create and link alert rules to panels&lt;/h1&gt;
&lt;p&gt;Grafana allows you to link an alert rule to a dashboard panel. This can help you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inform alert responders about where to investigate and which data to examine.&lt;/li&gt;
&lt;li&gt;Visualize the alert state directly from dashboards.&lt;/li&gt;
&lt;li&gt;Include a screenshot of the panel in notification messages.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An alert rule is linked to a panel by setting the 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#annotations&#34;&gt;&lt;code&gt;__dashboardUid__&lt;/code&gt; and &lt;code&gt;__panelId__&lt;/code&gt; annotations&lt;/a&gt;. Both annotations must be set together.&lt;/p&gt;
&lt;h2 id=&#34;link-alert-rules-to-panels&#34;&gt;Link alert rules to panels&lt;/h2&gt;
&lt;p&gt;When configuring the alert rule, you can set the dashboard and panel annotations as shown in this &lt;a href=&#34;https://youtu.be/ClLp-iSoaSY?si=qKWnvSVaQuvYcuw9&amp;amp;t=170&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;video&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Configure the alert rule.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Configure notification message&lt;/strong&gt; section, click &lt;strong&gt;Link dashboard and panel&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select an existing dashboard, then choose a panel from the selected dashboard.&lt;/li&gt;
&lt;li&gt;Complete the alert rule configuration and click &lt;strong&gt;Save rule&lt;/strong&gt; to initiate the alert rule.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can then 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/monitor-status/view-alert-state/#view-alert-state-on-panels&#34;&gt;view the alert state on the panel&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By default, notification messages include a link to the dashboard panel. Additionally, you can 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/template-notifications/images-in-notifications/&#34;&gt;enable displaying panel screenshots in notifications&lt;/a&gt;.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1200px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link captioned&#34;
        href=&#34;/media/docs/alerting/panel-displays-alert-state.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload mb-0&#34;
          data-src=&#34;/media/docs/alerting/panel-displays-alert-state.png&#34;data-srcset=&#34;/media/docs/alerting/panel-displays-alert-state.png?w=320 320w, /media/docs/alerting/panel-displays-alert-state.png?w=550 550w, /media/docs/alerting/panel-displays-alert-state.png?w=750 750w, /media/docs/alerting/panel-displays-alert-state.png?w=900 900w, /media/docs/alerting/panel-displays-alert-state.png?w=1040 1040w, /media/docs/alerting/panel-displays-alert-state.png?w=1240 1240w, /media/docs/alerting/panel-displays-alert-state.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;A panel displaying the alert status and state changes.&#34;width=&#34;1674&#34;height=&#34;700&#34;title=&#34;A panel displaying the alert status and state changes.&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/alerting/panel-displays-alert-state.png&#34;
            alt=&#34;A panel displaying the alert status and state changes.&#34;width=&#34;1674&#34;height=&#34;700&#34;title=&#34;A panel displaying the alert status and state changes.&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;A panel displaying the alert status and state changes.&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h2 id=&#34;create-alert-rules-from-panels&#34;&gt;Create alert rules from panels&lt;/h2&gt;
&lt;p&gt;To streamline alert creation, you can create an alert rule directly from a panel.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to a dashboard in the &lt;strong&gt;Dashboards&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;Hover over the top-right corner of a panel and click the panel menu icon.&lt;/li&gt;
&lt;li&gt;From the dropdown menu, select &lt;strong&gt;More&amp;hellip;&lt;/strong&gt; &amp;gt; &lt;strong&gt;New alert rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;This opens the &lt;strong&gt;Edit rule&lt;/strong&gt; form and pre-fills some values:
&lt;ul&gt;
&lt;li&gt;Sets the annotations to the corresponding dashboard and panel.&lt;/li&gt;
&lt;li&gt;Sets the alert rule query using the panel query.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Complete the alert rule configuration and click &lt;strong&gt;Save rule&lt;/strong&gt; to initiate the alert rule.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;You can then 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/monitor-status/view-alert-state/#view-alert-state-on-panels&#34;&gt;view the alert state on the panel&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By default, notification messages include a link to the dashboard panel. Additionally, you can 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/template-notifications/images-in-notifications/&#34;&gt;enable displaying panel screenshots in notifications&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Changes to panel and alert rule queries aren&amp;rsquo;t synchronized. If you change a query, you have to update it in both the panel and the alert rule.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;access-linked-alert-rules-from-panels&#34;&gt;Access linked alert rules from panels&lt;/h2&gt;
&lt;p&gt;This option is available only in 
    &lt;a href=&#34;/docs/grafana/v13.3/visualizations/panels-visualizations/visualizations/time-series/&#34;&gt;time series panels&lt;/a&gt;. To access alert rules associated to a time series panel, complete the following steps.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Hover over the top-right corner of the panel and click the panel menu icon.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Edit&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Alert&lt;/strong&gt; tab to view existing alert rules or create a new one.&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;For a practical example, refer to our &lt;a href=&#34;http://www.grafana.com/tutorials/alerting-get-started-pt6/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Getting started: Link alerts to visualizations tutorial&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="create-and-link-alert-rules-to-panels">Create and link alert rules to panels&lt;/h1>
&lt;p>Grafana allows you to link an alert rule to a dashboard panel. This can help you:&lt;/p>
&lt;ul>
&lt;li>Inform alert responders about where to investigate and which data to examine.&lt;/li>
&lt;li>Visualize the alert state directly from dashboards.&lt;/li>
&lt;li>Include a screenshot of the panel in notification messages.&lt;/li>
&lt;/ul>
&lt;p>An alert rule is linked to a panel by setting the
&lt;a href="/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#annotations">&lt;code>__dashboardUid__&lt;/code> and &lt;code>__panelId__&lt;/code> annotations&lt;/a>. Both annotations must be set together.&lt;/p></description></item><item><title>Import data source-managed rules to Grafana-managed rules</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/alerting-migration/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/alerting-migration/</guid><content><![CDATA[&lt;h1 id=&#34;import-data-source-managed-rules-to-grafana-managed-rules&#34;&gt;Import data source-managed rules to Grafana-managed rules&lt;/h1&gt;
&lt;p&gt;You can convert existing alert rules from data sources such as Mimir, Loki, and Prometheus into Grafana-managed alert rules. This enables you to operate and manage these rules using Grafana Alerting.&lt;/p&gt;
&lt;p&gt;This guide explains two methods for importing data source-managed rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Using the &lt;a href=&#34;#import-rules-with-grafana-alerting&#34;&gt;Grafana Alerting user interface&lt;/a&gt; to import rules from connected data sources or Prometheus rule YAML files.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Using &lt;a href=&#34;#import-rules-with-command-line-tools&#34;&gt;command-line tools&lt;/a&gt; like &lt;code&gt;mimirtool&lt;/code&gt; and &lt;code&gt;cortextool&lt;/code&gt; to import rules from YAML files.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Importing rules is a safe operation: the original data source–managed rules remain intact in their original location. During import, the rules are converted into Grafana-managed rules while preserving their configuration and behavior.&lt;/p&gt;
&lt;p&gt;Choose the method that best fits your workflow. As a best practice, test and validate your import process before migrating all alert rules.&lt;/p&gt;
&lt;h2 id=&#34;import-your-notification-configuration-first&#34;&gt;Import your notification configuration first&lt;/h2&gt;
&lt;p&gt;Rules only tell you about a problem if the notification reaches someone. Grafana-managed rules route through the Grafana Alertmanager, not through the Alertmanager your data source-managed rules used, so imported rules notify through whatever contact points and notification policies already exist in Grafana.&lt;/p&gt;
&lt;p&gt;Consider 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/import-alertmanager-configuration/&#34;&gt;importing your Alertmanager configuration&lt;/a&gt; before you import rules. Grafana imports the configuration as it is and runs it the way your Prometheus or Mimir Alertmanager does. You can then route the rules you import through the imported policy tree.&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&lt;/h2&gt;
&lt;p&gt;When you use any of the import methods, data source–managed rules are copied to another folder as Grafana-managed rules.&lt;/p&gt;
&lt;p&gt;The original data source–managed rules remain intact in their original location.&lt;/p&gt;
&lt;p&gt;The copied rules are converted to Grafana-managed rules, preserving their behavior by using equivalent Grafana-managed features. The following settings are applied during the conversion:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unique UIDs&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The newly created rules are assigned unique UIDs.
If you don’t want a UID to be auto-generated, you can specify one using the &lt;code&gt;__grafana_alert_rule_uid__&lt;/code&gt; label.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Query offset&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A query offset is applied to each rule. For example, an offset of &lt;code&gt;1m&lt;/code&gt; adjusts the query&amp;rsquo;s time range to &lt;code&gt;To: now-1m&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The rule query offset is taken from the &lt;code&gt;query_offset&lt;/code&gt; value in the rule group configuration. If empty, it defaults to the 
    &lt;a href=&#34;/docs/grafana/v13.3/setup-grafana/configure-grafana/#rule_query_offset&#34;&gt;&lt;code&gt;rule_query_offset&lt;/code&gt; configuration setting&lt;/a&gt;, which is &lt;code&gt;1m&lt;/code&gt; by default.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rule query conversion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For alert rules, adds &lt;code&gt;prometheus_math&lt;/code&gt; and &lt;code&gt;threshold&lt;/code&gt; expressions to preserve Prometheus no data behavior, ensuring the alert stays in &lt;strong&gt;Normal&lt;/strong&gt; state when &lt;code&gt;query&lt;/code&gt; returns no data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Missing series evaluations to resolve&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/stale-alert-instances/#configure-missing-series-evaluations-to-resolve&#34;&gt;Missing series evaluations to resolve&lt;/a&gt; setting is set to &lt;code&gt;1&lt;/code&gt; to replicate Prometheus’s alert eviction behavior.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rule group labels&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Labels defined at the rule group level are added as labels to each imported rule within the group.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Sequential evaluation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Imported rules are evaluated sequentially within each rule group, mirroring Prometheus behavior. This differs from native Grafana-managed alert rules, where the evaluation order is not enforced. For more details, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/&#34;&gt;evaluation strategies&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Feature compatibility&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The rule group &lt;code&gt;limit&lt;/code&gt; option and the &lt;code&gt;query&lt;/code&gt; function within alert rule templates are not currently supported in Grafana-managed rules. If the &lt;code&gt;limit&lt;/code&gt; option is present, the import fails. However, rules with &lt;code&gt;query&lt;/code&gt; in templates are imported.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Rules with the label &lt;code&gt;__grafana_origin&lt;/code&gt; are not included in rule imports. These rules are typically created by apps such as &lt;strong&gt;Kubernetes Monitoring&lt;/strong&gt;, &lt;strong&gt;Synthetic Monitoring&lt;/strong&gt;, and other &lt;strong&gt;Grafana plugins&lt;/strong&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;import-rules-with-grafana-alerting&#34;&gt;Import rules with Grafana Alerting&lt;/h2&gt;
&lt;p&gt;You can use the Grafana Alerting user interface to import rules from the following sources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Connected Mimir and Loki data sources with the ruler API enabled&lt;/li&gt;
&lt;li&gt;Prometheus YAML rule files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Imported rules using this method are editable in the user interface. Like regular Grafana-managed rules, you can later export them for provisioning.&lt;/p&gt;
&lt;h4 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h4&gt;
&lt;p&gt;To use Grafana Alerting to migrate rules, you need the following &lt;a href=&#34;/docs/grafana/latest/administration/roles-and-permissions/access-control/&#34;&gt;RBAC permissions&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Alerting&lt;/strong&gt;: &lt;code&gt;Rules Writer&lt;/code&gt;, &lt;code&gt;Set provisioning status&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Datasources&lt;/strong&gt;: &lt;code&gt;Reader&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Folders&lt;/strong&gt;: &lt;code&gt;Creator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The Folders permission is optional and only necessary if you want to create new folders for your target namespace. If your account doesn&amp;rsquo;t have permissions to view a namespace, the tool creates a new one.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To convert data source-managed alert rules to Grafana managed alerts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;Alerting &amp;gt; Alert rules&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Navigate to the Data source-managed alert rules section and click &lt;strong&gt;Import to Grafana-managed rules&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose the &lt;strong&gt;Import source&lt;/strong&gt; from which you want to import rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Existing data source-managed rules&lt;/strong&gt; to import rules from connected Mimir or Loki data sources with the ruler API enabled.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Prometheus YAML file&lt;/strong&gt; to import rules by uploading a Prometheus YAML rule file.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Data source&lt;/strong&gt; dropdown, select the data source that the imported alert rules will query.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) In Additional settings, select a target folder or designate a new folder to import the rules into.&lt;/p&gt;
&lt;p&gt;If you import the rules into an existing folder, don&amp;rsquo;t choose a folder with existing alert rules, as they could get overwritten.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) Select a Namespace and/or Group to determine which rules are imported.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) Turn on &lt;strong&gt;Pause imported alerting rules&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Pausing stops alert rule evaluation and doesn’t create any alert instances for the newly created Grafana-managed alert rules.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) Turn on &lt;strong&gt;Pause imported recording rules&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Pausing stops alert rule evaluation behavior for the newly created Grafana-managed alert rules.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) In the &lt;strong&gt;Target data source&lt;/strong&gt; of the &lt;strong&gt;Recording rules&lt;/strong&gt; section, you can select the data source to which the imported recording rules will write metrics. By default, it is the data source selected in the &lt;strong&gt;Data source&lt;/strong&gt; dropdown.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Import&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;A preview shows the rules that will be imported. If your target folder contains folders with the same name of the imported folders, a warning displays to inform you. You can explore the warning to see a list of folders that might be overwritten.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Yes, import&lt;/strong&gt; to import the rules.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;import-rules-with-command-line-tools&#34;&gt;Import rules with command-line tools&lt;/h2&gt;
&lt;p&gt;You can also use command-line tools to import data source-managed rules as Grafana-managed rules: use &lt;code&gt;mimirtool&lt;/code&gt; for Mimir and Prometheus rules, and &lt;code&gt;cortextool&lt;/code&gt; for Loki rules.&lt;/p&gt;
&lt;p&gt;Both tools provide &lt;code&gt;rules&lt;/code&gt; commands to import rules groups. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rules load&lt;/code&gt; can import rule groups from files.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rules sync&lt;/code&gt; can read rule files and applies only the differences compared to existing Grafana-managed rules. This is useful for automation workflows and pipelines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By default, rules imported using the API or command-line tools are &lt;strong&gt;Provisioned&lt;/strong&gt; and not editable in the user interface. To make them editable, enable the &lt;a href=&#34;#x-disable-provenance&#34;&gt;X-Disable-Provenance&lt;/a&gt; header.&lt;/p&gt;
&lt;h4 id=&#34;before-you-begin-1&#34;&gt;Before you begin&lt;/h4&gt;
&lt;p&gt;You need to have installed &lt;a href=&#34;/docs/mimir/latest/manage/tools/mimirtool/&#34;&gt;&lt;code&gt;mimirtool&lt;/code&gt;&lt;/a&gt; or &lt;a href=&#34;https://github.com/grafana/cortex-tools&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;cortextool&lt;/code&gt;&lt;/a&gt; (version &lt;code&gt;0.11.3&lt;/code&gt; or later).&lt;/p&gt;
&lt;p&gt;You need a service account with the following &lt;a href=&#34;/docs/grafana/latest/administration/roles-and-permissions/access-control/&#34;&gt;RBAC permissions&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Alerting&lt;/strong&gt;: &lt;code&gt;Rules Reader&lt;/code&gt;, &lt;code&gt;Rules Writer&lt;/code&gt;, &lt;code&gt;Set provisioning status&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Datasources&lt;/strong&gt;: &lt;code&gt;Reader&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Folders&lt;/strong&gt;: &lt;code&gt;Creator&lt;/code&gt;, &lt;code&gt;Reader&lt;/code&gt;, &lt;code&gt;Writer&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You need to a service account token with your service account. For more details, refer to &lt;a href=&#34;/docs/grafana/latest/administration/service-accounts/&#34;&gt;service accounts and service account tokens&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;mimirtool&#34;&gt;mimirtool&lt;/h3&gt;
&lt;p&gt;To convert and import them into a Grafana instance, you can use the &lt;code&gt;mimirtool rules load&lt;/code&gt; command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;MIMIR_ADDRESS=&amp;lt;GRAFANA_BASE_URL&amp;gt;/api/convert/ \
MIMIR_AUTH_TOKEN=&amp;lt;SERVICE_ACCOUNT_TOKEN&amp;gt; \
MIMIR_TENANT_ID=1 \
mimirtool rules load rule_file.yaml \
  --extra-headers &amp;#34;X-Grafana-Alerting-Datasource-UID=&amp;lt;DATASOURCE_UID_QUERY_TARGET&amp;gt;&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command imports Prometheus alert rules defined in &lt;code&gt;rule_file.yaml&lt;/code&gt; as Grafana-managed alert rules. It&amp;rsquo;s important to know that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When using the &lt;code&gt;&amp;lt;GRAFANA_BASE_URL&amp;gt;/api/convert/&lt;/code&gt; endpoint, &lt;code&gt;mimirtool&lt;/code&gt; interacts with Grafana—not with a Mimir instance. In this case, &lt;code&gt;MIMIR_TENANT_ID&lt;/code&gt; must always be set to &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;#x-grafana-alerting-datasource-uid&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Datasource-UID&lt;/code&gt; header&lt;/a&gt; configures the data source that the imported alert rules will query. Use multiple &lt;code&gt;--extra-headers&lt;/code&gt; flags to include other &lt;a href=&#34;#optional-headers&#34;&gt;optional headers&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Similarly, the &lt;code&gt;rules sync&lt;/code&gt; command can import and update Grafana-managed alert rules.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;MIMIR_ADDRESS=&amp;lt;GRAFANA_BASE_URL&amp;gt;/api/convert/ \
MIMIR_AUTH_TOKEN=&amp;lt;SERVICE_ACCOUNT_TOKEN&amp;gt; \
MIMIR_TENANT_ID=1 \
mimirtool rules sync rule_file.yaml \
  --extra-headers &amp;#34;X-Grafana-Alerting-Datasource-UID=&amp;lt;DATASOURCE_UID_QUERY_TARGET&amp;gt;&amp;#34; \
  --concurrency 1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;--concurrency&lt;/code&gt; flag must be set to &lt;code&gt;1&lt;/code&gt;, as the default value of &lt;code&gt;8&lt;/code&gt; may cause API errors.&lt;/p&gt;
&lt;p&gt;This &lt;code&gt;sync&lt;/code&gt; command reads rules from the file, compares them with the existing Grafana-managed rules in the instance, and applies only the differences—creating, updating, or deleting rules as needed.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;output&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-output&#34;&gt;## Sync Summary: 0 Groups Created, 1 Groups Updated, 0 Groups Deleted&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information other Mimirtool commands and options, see the &lt;a href=&#34;/docs/mimir/latest/manage/tools/mimirtool/#rules&#34;&gt;Mimirtool documentation&lt;/a&gt; and the &lt;a href=&#34;/docs/mimir/latest/references/http-api/#ruler-rules:~:text=config/v1/rules-,Get%20rule%20groups%20by%20namespace,DELETE%20%3Cprometheus%2Dhttp%2Dprefix%3E/config/v1/rules/%7Bnamespace%7D,-Delete%20tenant%20configuration&#34;&gt;Mimir HTTP Rule API documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cortextool&#34;&gt;cortextool&lt;/h3&gt;
&lt;p&gt;For Loki alert rules, use &lt;a href=&#34;https://github.com/grafana/cortex-tools&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;cortextool&lt;/code&gt;&lt;/a&gt; (version &lt;code&gt;0.11.3&lt;/code&gt; or later) with the &lt;code&gt;--backend=loki&lt;/code&gt; flag. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;CORTEX_ADDRESS=&amp;lt;GRAFANA_BASE_URL&amp;gt;/api/convert/ \
CORTEX_AUTH_TOKEN=&amp;lt;SERVICE_ACCOUNT_TOKEN&amp;gt; \
CORTEX_TENANT_ID=1 \
cortextool rules load loki_rules.yaml \
  --extra-headers &amp;#34;X-Grafana-Alerting-Datasource-UID=&amp;lt;LOKI_DATASOURCE_UID_QUERY_TARGET&amp;gt;&amp;#34; \
  --backend=loki&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;optional-headers&#34;&gt;Optional Headers&lt;/h3&gt;
&lt;p&gt;Additional configuration headers for more granular import control include the following:&lt;/p&gt;
&lt;h4 id=&#34;x-disable-provenance&#34;&gt;&lt;code&gt;X-Disable-Provenance&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;When this header is set to &lt;code&gt;true&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The imported rules are not marked as provisioned.&lt;/li&gt;
&lt;li&gt;They can then be edited in the Grafana UI.&lt;/li&gt;
&lt;li&gt;They are excluded from the &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; operations on the &lt;a href=&#34;#compatible-endpoints&#34;&gt;&lt;code&gt;/api/convert&lt;/code&gt; endpoints&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Do not enable this header when using the &lt;code&gt;rules sync&lt;/code&gt; command, as it relies on the &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; operations to detect and update existing rules.&lt;/p&gt;
&lt;h4 id=&#34;x-grafana-alerting-alert-rules-paused&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Alert-Rules-Paused&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Set to &lt;code&gt;true&lt;/code&gt; to import alert rules in paused state.&lt;/p&gt;
&lt;h4 id=&#34;x-grafana-alerting-recording-rules-paused&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Recording-Rules-Paused&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Set to &lt;code&gt;true&lt;/code&gt; to import recording rules in paused state.&lt;/p&gt;
&lt;h4 id=&#34;x-grafana-alerting-datasource-uid&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Datasource-UID&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;The UID of the data source to use for alert rule queries.&lt;/p&gt;
&lt;p&gt;If not specified in the header, Grafana uses the configured default from &lt;code&gt;unified_alerting.prometheus_conversion.default_datasource_uid&lt;/code&gt;. If neither the header nor the configuration option is provided, the request fails.&lt;/p&gt;
&lt;h4 id=&#34;x-grafana-alerting-target-datasource-uid&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Target-Datasource-UID&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;The UID of the target data source for recording rules. If not specified, the value from &lt;code&gt;X-Grafana-Alerting-Datasource-UID&lt;/code&gt; is used.&lt;/p&gt;
&lt;h4 id=&#34;x-grafana-alerting-folder-uid&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Folder-UID&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Enter the UID of the target destination folder for imported rules.&lt;/p&gt;
&lt;h4 id=&#34;x-grafana-alerting-notification-settings&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Notification-Settings&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;JSON-encoded &lt;a href=&#34;#alertrulenotificationsettings-object&#34;&gt;&lt;code&gt;AlertRuleNotificationSettings&lt;/code&gt; object&lt;/a&gt; that allows setting the contact point for the alert rules.&lt;/p&gt;
&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;AlertRuleNotificationSettings object&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;&lt;h5 id=&#34;alertrulenotificationsettings-object&#34;&gt;AlertRuleNotificationSettings object&lt;/h5&gt;
&lt;p&gt;When you set &lt;code&gt;X-Grafana-Alerting-Notification-Settings&lt;/code&gt;, the header value must be a JSON-encoded object with the following keys:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Field&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
              &lt;th&gt;Example&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;receiver&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;grafana-default&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Name of the contact point (receiver) to which alerts are routed. Must exist in Grafana before import.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;group_by&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;alertname&amp;quot;,&amp;quot;grafana_folder&amp;quot;,&amp;quot;cluster&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Label set used by Alertmanager to aggregate alerts into a single notification.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;group_wait&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;30s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How long Alertmanager waits before sending the first notification for a new group.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;group_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;5m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Time to wait before adding new alerts to an existing group&amp;rsquo;s next notification.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;repeat_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;4h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum time before a previously-sent notification is repeated. Must not be less than &lt;code&gt;group_interval&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mute_time_intervals&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;maintenance&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;One or more mute time interval names that silence alerts during those windows.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;active_time_intervals&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;maintenance&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of active time interval names. Alerts are suppressed unless the current time matches one of them.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h3 id=&#34;compatible-endpoints&#34;&gt;Compatible endpoints&lt;/h3&gt;
&lt;p&gt;The API endpoints listed in this section are supported in Grafana and are used by &lt;code&gt;mimirtool&lt;/code&gt; and &lt;code&gt;cortextool&lt;/code&gt;, as shown earlier. These endpoints are compatible with &lt;a href=&#34;/docs/mimir/latest/references/http-api/&#34;&gt;Mimir HTTP API&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In these endpoints, a &amp;ldquo;namespace&amp;rdquo; corresponds to a folder title in Grafana.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;POST&lt;/code&gt; endpoints can be used to import data source–managed alert rules. They accept requests in both YAML and JSON. If no media type is specified, YAML is assumed.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Endpoint&lt;/th&gt;
              &lt;th&gt;Method&lt;/th&gt;
              &lt;th&gt;Summary&lt;/th&gt;
              &lt;th&gt;Mimir equivalent&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;POST&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#create-or-update-multiple-rule-groups&#34;&gt;Create or update multiple rule groups&lt;/a&gt; across multiple namespaces. Requires &lt;a href=&#34;#x-grafana-alerting-datasource-uid&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Datasource-UID&lt;/code&gt;&lt;/a&gt;.&lt;/td&gt;
              &lt;td&gt;None&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;POST&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules/:namespaceTitle&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Create or update a single rule group in a namespace. Requires &lt;a href=&#34;#x-grafana-alerting-datasource-uid&#34;&gt;&lt;code&gt;X-Grafana-Alerting-Datasource-UID&lt;/code&gt;&lt;/a&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;/docs/mimir/latest/references/http-api/#set-rule-group&#34;&gt;Set rule group&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; endpoints work only with provisioned and imported alert rules. All &lt;code&gt;GET&lt;/code&gt; endpoints support both JSON and YAML response formats based on the &lt;code&gt;Accept&lt;/code&gt; header: use &lt;code&gt;application/json&lt;/code&gt; for JSON responses, or &lt;code&gt;application/yaml&lt;/code&gt; for YAML responses. YAML is the default format when no &lt;code&gt;Accept&lt;/code&gt; header is specified.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Endpoint&lt;/th&gt;
              &lt;th&gt;Method&lt;/th&gt;
              &lt;th&gt;Summary&lt;/th&gt;
              &lt;th&gt;Mimir equivalent&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;GET&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Get all imported rule groups across all namespaces.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;/docs/mimir/latest/references/http-api/#list-rule-groups&#34;&gt;List rule groups&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;GET&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules/:namespaceTitle&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Get imported rule groups in a specific namespace.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;/docs/mimir/latest/references/http-api/#get-rule-groups-by-namespace&#34;&gt;Get rule groups by namespace&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;GET&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules/:namespaceTitle/:group&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Get imported rule group in a specific namespace.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;/docs/mimir/latest/references/http-api/#get-rule-group&#34;&gt;Get rule group&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;DELETE&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules/:namespaceTitle&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Delete all imported alert rules in a namespace.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;/docs/mimir/latest/references/http-api/#delete-namespace&#34;&gt;Delete namespace&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;DELETE&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/convert/prometheus/config/v1/rules/:namespaceTitle/:group&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Delete a specific imported rule group.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;/docs/mimir/latest/references/http-api/#delete-rule-group&#34;&gt;Delete rule group&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h4 id=&#34;create-or-update-multiple-rule-groups&#34;&gt;Create or update multiple rule groups&lt;/h4&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;POST /convert/prometheus/config/v1/rules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Creates or updates multiple rule groups across multiple namespaces. This endpoint expects a request with a map of namespace titles to arrays of rule groups, and returns &lt;code&gt;202&lt;/code&gt; on success.&lt;/p&gt;
&lt;p&gt;This endpoint has no Mimir equivalent and is Grafana-specific for bulk operations.&lt;/p&gt;
&lt;h5 id=&#34;example-request-body&#34;&gt;Example request body&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;namespace1:
  - name: MyGroupName1
    rules:
      - alert: MyAlertName1
        expr: up == 0
        labels:
          severity: warning
namespace2:
  - name: MyGroupName2
    rules:
      - alert: MyAlertName2
        expr: rate(http_requests_total[5m]) &amp;gt; 0.1
        labels:
          severity: critical&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="import-data-source-managed-rules-to-grafana-managed-rules">Import data source-managed rules to Grafana-managed rules&lt;/h1>
&lt;p>You can convert existing alert rules from data sources such as Mimir, Loki, and Prometheus into Grafana-managed alert rules. This enables you to operate and manage these rules using Grafana Alerting.&lt;/p></description></item><item><title>Configure data source-managed alert rules</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/create-data-source-managed-rule/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/create-data-source-managed-rule/</guid><content><![CDATA[

&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Pre-provisioned Loki and Prometheus data source-managed alerts have been deprecated in Grafana Cloud and can not be created in new stacks.
New Grafana Cloud stacks will use Grafana-managed alerting (GMA) by default. Datasource-managed alerting (DMA) is not provisioned in new stacks. Existing stacks are not affected.&lt;/p&gt;
&lt;p&gt;This applies to the default Loki and Prometheus Grafana Cloud data sources managed by Grafana Labs and Cloud Alertmanager, which will not be available nor will Grafana provision the data source for it. If you add your own Mimir, Loki, or Alertmanager data sources, you can continue to use data source-managed alerts.&lt;/p&gt;
&lt;p&gt;Cloud users can import DMA rules into GMA rules with the import tool. See the &lt;a href=&#34;/docs/grafana/latest/alerting/alerting-rules/alerting-migration/&#34;&gt;import data source-managed alerts to Grafana-managed alerts documentation&lt;/a&gt; for information on how to do this.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h1 id=&#34;configure-data-source-managed-alert-rules&#34;&gt;Configure data source-managed alert rules&lt;/h1&gt;
&lt;p&gt;Data source-managed alert rules are alert rules that are stored in the data source, such as in Prometheus or Loki, rather than in Grafana.&lt;/p&gt;
&lt;p&gt;In Grafana Alerting, you can:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create and edit data source-managed rules for Grafana Mimir and Grafana Loki data sources.&lt;/li&gt;
&lt;li&gt;View rules from Prometheus data sources when 
    &lt;a href=&#34;/docs/grafana/v13.3/datasources/prometheus/configure/&#34;&gt;Manage alerts via Alerting UI&lt;/a&gt; is enabled. However, you cannot create or edit these rules in Grafana.&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/alerting-migration/&#34;&gt;Import data source-managed rules&lt;/a&gt; from Loki, Mimir, and Prometheus into Grafana-managed rules.&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Data source-managed rules are supported for horizontal scalability, but they can introduce more operational complexity than Grafana-managed alert rules.&lt;/p&gt;
&lt;p&gt;We recommend using 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/create-grafana-managed-rule/&#34;&gt;Grafana-managed alert rules&lt;/a&gt; whenever possible, as they provide a richer feature set and better integration with the full Grafana Alerting workflow.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;comparison-with-grafana-managed-rules&#34;&gt;Comparison with Grafana-managed rules&lt;/h2&gt;
&lt;p&gt;The table below compares Grafana-managed and data source-managed alert rules.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;div style=&#34;width:200px&#34;&gt;Feature&lt;/div&gt;&lt;/th&gt;
              &lt;th&gt;&lt;div style=&#34;width:200px&#34;&gt;Grafana-managed alert rule&lt;/div&gt;&lt;/th&gt;
              &lt;th&gt;&lt;div style=&#34;width:200px&#34;&gt;Data source-managed alert rule&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Supported data sources&lt;/td&gt;
              &lt;td&gt;All backend data sources enabling the 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/configure-rbac/&#34;&gt;&lt;code&gt;alerting&lt;/code&gt; option&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Only supports creating rules for Mimir and Loki data sources&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Mix and match data sources&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Add 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/#advanced-options-expressions&#34;&gt;expressions&lt;/a&gt; to transform&lt;wbr /&gt; your data and set 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/queries-conditions/#alert-condition&#34;&gt;alert conditions&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/nodata-and-error-states/&#34;&gt;No data and error states&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/stale-alert-instances/&#34;&gt;Stale alert instances&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/template-notifications/images-in-notifications/&#34;&gt;Images in alert notifications&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/configure-rbac/&#34;&gt;Role-based access control&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/monitor-status/view-alert-state-history/&#34;&gt;Alert state history&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/monitor-status/view-alert-rules/#view-compare-and-restore-alert-rules-versions&#34;&gt;Alert version history&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/provision-alerting-resources/terraform-provisioning/&#34;&gt;Terraform provisioning&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/&#34;&gt;Recording rules&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Organization&lt;/td&gt;
              &lt;td&gt;Organize and manage access with folders&lt;/td&gt;
              &lt;td&gt;Use namespaces&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Alert rule evaluation&lt;/td&gt;
              &lt;td&gt;Alert evaluation is done in Grafana&lt;/td&gt;
              &lt;td&gt;Alert rule evaluation is done in the data source and allow for horizontal scaling&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Scaling&lt;/td&gt;
              &lt;td&gt;Alert rules are stored in the Grafana database.&lt;/td&gt;
              &lt;td&gt;Alert rules are stored within the data source and allow for horizontal scaling&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The following diagram shows the architecture of a Mimir setup that uses data source-managed alert rules.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 750px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/alerting/mimir-managed-alerting-architecture-v2.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/alerting/mimir-managed-alerting-architecture-v2.png&#34;data-srcset=&#34;/media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=320 320w, /media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=550 550w, /media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=750 750w, /media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=900 900w, /media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=1040 1040w, /media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=1240 1240w, /media/docs/alerting/mimir-managed-alerting-architecture-v2.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Data source-managed alerting architecture based on Grafana Mimir&#34;width=&#34;1866&#34;height=&#34;816&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/alerting/mimir-managed-alerting-architecture-v2.png&#34;
            alt=&#34;Data source-managed alerting architecture based on Grafana Mimir&#34;width=&#34;1866&#34;height=&#34;816&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h2 id=&#34;create-data-source-managed-alert-rules&#34;&gt;Create data source-managed alert rules&lt;/h2&gt;
&lt;p&gt;To create or edit data source-managed alert rules, follow these instructions.&lt;/p&gt;
&lt;h3 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h3&gt;
&lt;p&gt;Verify that you have write permission to the Mimir or Loki data source. Otherwise, you cannot create or update data source-managed alert rules.&lt;/p&gt;
&lt;h4 id=&#34;enable-the-ruler-api&#34;&gt;Enable the Ruler API&lt;/h4&gt;
&lt;p&gt;For more information, refer to the &lt;a href=&#34;/docs/mimir/latest/references/http-api/#ruler&#34;&gt;Mimir Ruler API&lt;/a&gt; or &lt;a href=&#34;/docs/loki/latest/api/#ruler&#34;&gt;Loki Ruler API&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mimir&lt;/strong&gt; - use the &lt;code&gt;/prometheus&lt;/code&gt; prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the &lt;a href=&#34;/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend&#34;&gt;Query API&lt;/a&gt; and &lt;a href=&#34;/docs/mimir/latest/operators-guide/reference-http-api/#ruler&#34;&gt;Ruler API&lt;/a&gt; are under the same URL. You cannot provide a separate URL for the Ruler API.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Loki&lt;/strong&gt; - The &lt;code&gt;local&lt;/code&gt; rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;permissions&#34;&gt;Permissions&lt;/h4&gt;
&lt;p&gt;Alert rules for Mimir or Loki instances can be edited or deleted by users with &lt;strong&gt;Editor&lt;/strong&gt; or &lt;strong&gt;Admin&lt;/strong&gt; roles.&lt;/p&gt;
&lt;p&gt;If you do not want to manage alert rules for a particular data source, go to its settings and clear the &lt;strong&gt;Manage alerts via Alerting UI&lt;/strong&gt; checkbox.&lt;/p&gt;
&lt;h3 id=&#34;set-alert-rule-name&#34;&gt;Set alert rule name&lt;/h3&gt;


&lt;div data-shared=&#34;alerts/configure-alert-rule-name.md&#34;&gt;
            &lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Alerts &amp;amp; IRM&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt; -&amp;gt; &lt;strong&gt;&#43; New alert rule&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a name to identify your alert rule.&lt;/p&gt;
&lt;p&gt;This name is displayed in the alert rule list. It is also the &lt;code&gt;alertname&lt;/code&gt; label for every alert instance that is created from this rule.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

        
&lt;h3 id=&#34;define-query-and-condition&#34;&gt;Define query and condition&lt;/h3&gt;
&lt;p&gt;Define a query to get the data you want to measure and a condition that needs to be met before an alert rule fires.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;By default, new alert rules are Grafana-managed. To switch to &lt;strong&gt;Data source-managed&lt;/strong&gt;, follow these instructions.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a Prometheus-based data source from the drop-down list.&lt;/p&gt;
&lt;p&gt;You can also click &lt;strong&gt;Open advanced data source picker&lt;/strong&gt; to find more options.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a PromQL or LogQL query, including the alert condition.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Rule type&lt;/strong&gt; option, select &lt;strong&gt;Data source-managed&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Preview alerts&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;set-alert-evaluation-behavior&#34;&gt;Set alert evaluation behavior&lt;/h3&gt;
&lt;p&gt;Use 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/&#34;&gt;alert rule evaluation&lt;/a&gt; to determine how frequently an alert rule should be evaluated and how quickly it should change its state.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a namespace or click &lt;strong&gt;&#43; New namespace&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select an evaluation group or click &lt;strong&gt;&#43; New evaluation group&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you are creating a new evaluation group, specify the interval for the group.&lt;/p&gt;
&lt;p&gt;All rules within the same group are evaluated sequentially over the same time interval. You can reorder them from the &lt;strong&gt;Alert rules&lt;/strong&gt; page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a pending period.&lt;/p&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/#pending-period&#34;&gt;pending period&lt;/a&gt; is the period in which an alert rule can be in breach of the condition until it fires.&lt;/p&gt;
&lt;p&gt;After a condition is met, the alert goes into the &lt;strong&gt;Pending&lt;/strong&gt; state. If the condition remains active for the duration specified, the alert transitions to the &lt;strong&gt;Firing&lt;/strong&gt; state, else it reverts to the &lt;strong&gt;Normal&lt;/strong&gt; state.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;configure-labels-and-notifications&#34;&gt;Configure labels and notifications&lt;/h3&gt;
&lt;p&gt;Add 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#labels&#34;&gt;labels&lt;/a&gt; to your alert rules to set which 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/notifications/notification-policies/&#34;&gt;notification policy&lt;/a&gt; should handle your firing alert instances.&lt;/p&gt;
&lt;p&gt;All alert rules and instances, irrespective of their labels, match the default notification policy. If there are no nested policies, or no nested policies match the labels in the alert rule or alert instance, then the default notification policy is the matching policy.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add labels if you want to change the way your notifications are routed.&lt;/p&gt;
&lt;p&gt;Add custom labels by selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;configure-notification-message&#34;&gt;Configure notification message&lt;/h3&gt;
&lt;p&gt;Use 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#annotations&#34;&gt;annotations&lt;/a&gt; to add information to alert messages that can help respond to the alert.&lt;/p&gt;
&lt;p&gt;Annotations are included by default in notification messages, and can use text or 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/templates/&#34;&gt;templates&lt;/a&gt; to display dynamic data from queries.&lt;/p&gt;
&lt;p&gt;Grafana provides several optional annotations.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a summary.&lt;/p&gt;
&lt;p&gt;Short summary of what happened and why.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a description.&lt;/p&gt;
&lt;p&gt;Description of what the alert rule does.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a Runbook URL.&lt;/p&gt;
&lt;p&gt;Webpage where you keep your runbook for the alert&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add a custom annotation.&lt;/p&gt;
&lt;p&gt;Add any additional information that could help address the alert.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: &lt;strong&gt;Link dashboard and panel&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/link-alert-rules-to-panels/&#34;&gt;Link the alert rule to a panel&lt;/a&gt; to facilitate alert investigation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save rule&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>Pre-provisioned Loki and Prometheus data source-managed alerts have been deprecated in Grafana Cloud and can not be created in new stacks.
New Grafana Cloud stacks will use Grafana-managed alerting (GMA) by default. Datasource-managed alerting (DMA) is not provisioned in new stacks. Existing stacks are not affected.&lt;/p></description></item><item><title>Create recording rules</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/</guid><content><![CDATA[&lt;h1 id=&#34;configure-recording-rules&#34;&gt;Configure recording rules&lt;/h1&gt;
&lt;p&gt;Recording rules allow you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.&lt;/p&gt;
&lt;p&gt;For instance, you can create a recording rule generating a new metric, &lt;code&gt;error_9001_count&lt;/code&gt;, which counts occurrences of a specific log error within one minute. Then, query the &lt;code&gt;error_9001_count&lt;/code&gt; metric in dashboards and alert rules.&lt;/p&gt;
&lt;p&gt;Recording rules can be helpful in various scenarios, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Faster queries&lt;/strong&gt; are needed: Performing heavy aggregations or querying large data sets is quicker with precomputed results than real-time queries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reducing system load:&lt;/strong&gt; Precomputing specific queries in advance can reduce system overload caused by multiple simultaneous queries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Simplifying complex aggregations:&lt;/strong&gt; Create a new metric from complex aggregations to facilitate alert and dashboard setup.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reusing queries to reduce costs:&lt;/strong&gt; Improve efficiency by reusing the same query across similar alert rules and dashboards.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;how-recorded-metrics-work&#34;&gt;How recorded metrics work&lt;/h2&gt;
&lt;p&gt;A recording rule generates a new recorded metric by evaluating its rule definition on a fixed 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/evaluation-within-a-group/&#34;&gt;evaluation interval&lt;/a&gt; (for example, every &lt;code&gt;1m&lt;/code&gt; or &lt;code&gt;5m&lt;/code&gt;) and writing a single value as a new data point in the recorded metric.&lt;/p&gt;
&lt;p&gt;The rule definition must return that single value, either from an instant query or a range query combined with a &lt;strong&gt;Reduce&lt;/strong&gt; expression.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/alerting/recording-rules-diagram-v3.svg&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/alerting/recording-rules-diagram-v3.svg&#34;alt=&#34;How recording rules generate recorded metrics&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/alerting/recording-rules-diagram-v3.svg&#34;
            alt=&#34;How recording rules generate recorded metrics&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Recorded metrics are not guaranteed to exactly match the original raw data.&lt;/p&gt;
&lt;p&gt;Aggregations in the recording rule query and evaluation lags can produce results that differ from the original raw data. Shorter evaluation intervals can reduce this gap by improving resolution.&lt;/p&gt;
&lt;p&gt;For PromQL recommendations in recording rules, refer to &lt;a href=&#34;https://prometheus.io/docs/practices/rules/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus recording rules best practices&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;alerting-on-recorded-metrics&#34;&gt;Alerting on recorded metrics&lt;/h2&gt;
&lt;p&gt;When alert rules query recorded metrics, consider the following recommendations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Use frequent evaluation intervals&lt;/strong&gt;. Set frequent evaluation intervals for recording rules. Long intervals, such as an hour, can cause the recorded metric to be stale and lead to misaligned alert rule evaluations, especially when combined with a long pending period.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Align alert evaluation with recording frequency&lt;/strong&gt;. The evaluation interval of an alert rule that depends on a recorded metric should be aligned with the recording rule&amp;rsquo;s interval. If a recording rule runs every 3 minutes, the alert rule should also be evaluated at a similar frequency to ensure it acts on fresh data. For details about the evaluation sequence, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/evaluation-within-a-group/&#34;&gt;how rules are evaluated within a group&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use &lt;code&gt;_over_time&lt;/code&gt; functions for instant queries&lt;/strong&gt;. Since all alert rules are ultimately executed as an instant query, you can use functions like &lt;code&gt;max_over_time(my_metric[5m])&lt;/code&gt; as an instant query. This allows you to get an aggregated value over a period without using a range query and a reduce expression.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;types-of-recording-rules&#34;&gt;Types of recording rules&lt;/h2&gt;
&lt;p&gt;Similar to alert rules, Grafana supports two types of recording rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/create-grafana-managed-recording-rules/&#34;&gt;Grafana-managed recording rules&lt;/a&gt;, which can query any Grafana data source supported by alerting. It&amp;rsquo;s the recommended option.&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/create-data-source-managed-recording-rules/&#34;&gt;Data source-managed recording rules&lt;/a&gt;, which can query Prometheus-based data sources like Mimir or Loki.&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="configure-recording-rules">Configure recording rules&lt;/h1>
&lt;p>Recording rules allow you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.&lt;/p></description></item><item><title>Configure rule sequences</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/rule-sequences/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/rule-sequences/</guid><content><![CDATA[

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Rule sequences is currently in &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;public preview&lt;/a&gt;. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;


&lt;h1 id=&#34;configure-rule-sequences&#34;&gt;Configure rule sequences&lt;/h1&gt;
&lt;p&gt;Use rule sequences in Grafana Alerting when a recording rule or alert rule depends on the results of another recording rule. A rule sequence references existing Grafana-managed rules and defines their evaluation order and shared evaluation interval.&lt;/p&gt;
&lt;p&gt;You can create and manage rule sequences through the Grafana Alerting API or Terraform. The API uses &lt;code&gt;v0alpha1&lt;/code&gt; and is subject to change.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you create a sequence, ensure you have the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Grafana version:&lt;/strong&gt; Use Grafana Cloud or Grafana OSS or Enterprise 13.1 or later.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rules:&lt;/strong&gt; Create at least one Grafana-managed recording rule and any dependent recording rules or alert rules. Place all the rules in the same folder.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recording rule storage:&lt;/strong&gt; Ensure your recording rules write to a Prometheus-compatible data source. In Grafana Cloud, rules without an explicit target write to your managed Prometheus data source by default. In self-managed Grafana, configure a target data source or a default target. For details, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/create-grafana-managed-recording-rules/&#34;&gt;Create Grafana-managed recording rules&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API access:&lt;/strong&gt; Use an authenticated account with permission to manage alert rules in the folder. For authentication options, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/developer-resources/api-reference/http-api/authentication/&#34;&gt;Authentication options for the HTTP API&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;understand-evaluation-order&#34;&gt;Understand evaluation order&lt;/h2&gt;
&lt;p&gt;For each evaluation interval, Grafana evaluates the rules in two stages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Evaluate the recording rules in the order listed in &lt;code&gt;spec.recordingRules&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Evaluate the alert rules in the order listed in &lt;code&gt;spec.alertingRules&lt;/code&gt;, after the recording rules.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example, you can evaluate a recording rule that calculates a request rate, then a recording rule that uses that metric to calculate an error ratio, and then an alert rule that queries the error ratio.&lt;/p&gt;
&lt;p&gt;The sequence&amp;rsquo;s &lt;code&gt;spec.trigger.interval&lt;/code&gt; sets the evaluation interval for every rule in the sequence, overriding each rule&amp;rsquo;s individual interval while it belongs to the sequence. You continue to manage each rule&amp;rsquo;s queries, expressions, and other settings separately.&lt;/p&gt;
&lt;p&gt;Rules outside the sequence retain their existing evaluation behavior. A sequence defines evaluation order, not a general-purpose organizational group.&lt;/p&gt;
&lt;p&gt;Evaluation order doesn&amp;rsquo;t guarantee that a preceding rule produces new data. Grafana continues to the next rule even if a recording rule fails or returns no data. A dependent rule can query older data or receive no data, depending on its query and the target data source. Configure its error and no-data handling accordingly.&lt;/p&gt;
&lt;p&gt;Even when a recording rule succeeds, its samples might not be available to query immediately. Grafana waits for the write request to complete but doesn&amp;rsquo;t check whether the target data source can return the samples before it evaluates the next rule. A sequence guarantees evaluation order, not read-after-write consistency.&lt;/p&gt;
&lt;h2 id=&#34;create-a-sequence-with-the-api&#34;&gt;Create a sequence with the API&lt;/h2&gt;
&lt;p&gt;Create a &lt;code&gt;RuleSequence&lt;/code&gt; resource that references the rules by name. For alert rules and recording rules, use each resource&amp;rsquo;s &lt;code&gt;metadata.name&lt;/code&gt;, which corresponds to its rule UID.&lt;/p&gt;
&lt;p&gt;Send a &lt;code&gt;POST&lt;/code&gt; request to &lt;code&gt;/apis/rules.alerting.grafana.app/v0alpha1/namespaces/{namespace}/rulesequences&lt;/code&gt; with the &lt;code&gt;Content-Type: application/json&lt;/code&gt; header and the following body:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;apiVersion&amp;#34;: &amp;#34;rules.alerting.grafana.app/v0alpha1&amp;#34;,
  &amp;#34;kind&amp;#34;: &amp;#34;RuleSequence&amp;#34;,
  &amp;#34;metadata&amp;#34;: {
    &amp;#34;name&amp;#34;: &amp;#34;request-error-sequence&amp;#34;,
    &amp;#34;namespace&amp;#34;: &amp;#34;&amp;lt;NAMESPACE&amp;gt;&amp;#34;,
    &amp;#34;annotations&amp;#34;: {
      &amp;#34;grafana.app/folder&amp;#34;: &amp;#34;&amp;lt;FOLDER_UID&amp;gt;&amp;#34;
    }
  },
  &amp;#34;spec&amp;#34;: {
    &amp;#34;trigger&amp;#34;: {
      &amp;#34;interval&amp;#34;: &amp;#34;1m&amp;#34;
    },
    &amp;#34;recordingRules&amp;#34;: [{ &amp;#34;name&amp;#34;: &amp;#34;&amp;lt;REQUEST_RATE_RULE_UID&amp;gt;&amp;#34; }, { &amp;#34;name&amp;#34;: &amp;#34;&amp;lt;ERROR_RATIO_RULE_UID&amp;gt;&amp;#34; }],
    &amp;#34;alertingRules&amp;#34;: [{ &amp;#34;name&amp;#34;: &amp;#34;&amp;lt;ALERT_RULE_UID&amp;gt;&amp;#34; }]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the placeholders with the following values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;NAMESPACE&amp;gt;&lt;/code&gt;:&lt;/strong&gt; Use your Grafana instance&amp;rsquo;s namespace in both the request path and body. For namespace formats, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/developer-resources/api-reference/http-api/apis/#namespace-namespace&#34;&gt;API structure in Grafana&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;FOLDER_UID&amp;gt;&lt;/code&gt;:&lt;/strong&gt; Use the UID of the folder that contains all referenced rules.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;REQUEST_RATE_RULE_UID&amp;gt;&lt;/code&gt;:&lt;/strong&gt; Use the UID of the recording rule that calculates the request rate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;ERROR_RATIO_RULE_UID&amp;gt;&lt;/code&gt;:&lt;/strong&gt; Use the UID of the recording rule that queries the request-rate metric and calculates the error ratio.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;ALERT_RULE_UID&amp;gt;&lt;/code&gt;:&lt;/strong&gt; Use the UID of the alert rule that queries the error-ratio metric.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The example evaluates the three rules in that order every minute. Configure the dependent rules to query the metrics produced by the preceding recording rules. Adding a rule to a sequence doesn&amp;rsquo;t change its query or automatically connect it to another rule&amp;rsquo;s output.&lt;/p&gt;
&lt;p&gt;To retrieve the sequence, send a &lt;code&gt;GET&lt;/code&gt; request to &lt;code&gt;/apis/rules.alerting.grafana.app/v0alpha1/namespaces/{namespace}/rulesequences/{name}&lt;/code&gt;. Use &lt;code&gt;request-error-sequence&lt;/code&gt; as &lt;code&gt;{name}&lt;/code&gt; for this example.&lt;/p&gt;
&lt;h2 id=&#34;create-a-sequence-with-terraform&#34;&gt;Create a sequence with Terraform&lt;/h2&gt;
&lt;p&gt;Use the &lt;code&gt;grafana_apps_rules_rulesequence_v0alpha1&lt;/code&gt; resource to manage a sequence in Terraform. Set &lt;code&gt;metadata.folder_uid&lt;/code&gt; to the folder that contains the rules, and reference their UIDs in &lt;code&gt;spec.recording_rules&lt;/code&gt; and &lt;code&gt;spec.alerting_rules&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For a complete example and resource fields, refer to &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/apps_rules_rulesequence_v0alpha1&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;grafana_apps_rules_rulesequence_v0alpha1&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;update-or-remove-a-sequence&#34;&gt;Update or remove a sequence&lt;/h2&gt;
&lt;p&gt;To change the order, membership, or interval through the API, retrieve the current sequence and send the updated resource with a &lt;code&gt;PUT&lt;/code&gt; request to &lt;code&gt;/apis/rules.alerting.grafana.app/v0alpha1/namespaces/{namespace}/rulesequences/{name}&lt;/code&gt;. Preserve its &lt;code&gt;metadata.resourceVersion&lt;/code&gt; from the response.&lt;/p&gt;
&lt;p&gt;To remove a sequence, send a &lt;code&gt;DELETE&lt;/code&gt; request to &lt;code&gt;/apis/rules.alerting.grafana.app/v0alpha1/namespaces/{namespace}/rulesequences/{name}&lt;/code&gt;. Deleting a sequence doesn&amp;rsquo;t delete the rules it references.&lt;/p&gt;
&lt;p&gt;After Grafana picks up the change, rules removed from a sequence return to their stored evaluation interval and group settings.&lt;/p&gt;
&lt;p&gt;If you manage the sequence with Terraform, update or remove it in your Terraform configuration instead.&lt;/p&gt;
&lt;h2 id=&#34;sequence-constraints&#34;&gt;Sequence constraints&lt;/h2&gt;
&lt;p&gt;When you create or update a sequence, follow these constraints:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Recording rules:&lt;/strong&gt; Include at least one recording rule. Alert rules are optional.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Folder:&lt;/strong&gt; Place the sequence and all referenced rules in the same folder.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Membership:&lt;/strong&gt; Reference each rule only once. A rule can belong to only one sequence.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule changes:&lt;/strong&gt; Remove a rule from its sequence before you delete the rule or move it to another folder.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interval:&lt;/strong&gt; Use a positive interval that&amp;rsquo;s an integer multiple of your instance&amp;rsquo;s base evaluation interval. For example, with a base interval of &lt;code&gt;10s&lt;/code&gt;, you can use &lt;code&gt;10s&lt;/code&gt;, &lt;code&gt;30s&lt;/code&gt;, or &lt;code&gt;1m&lt;/code&gt;, but not &lt;code&gt;15s&lt;/code&gt;. The API rejects invalid intervals instead of adjusting them.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Self-managed evaluation jitter:&lt;/strong&gt; In Grafana OSS and Enterprise, keep the &lt;code&gt;jitterAlertRulesWithinGroups&lt;/code&gt; feature toggle disabled when you use rule sequences. This toggle disables sequential evaluation and is disabled by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;related-resources&#34;&gt;Related resources&lt;/h2&gt;
&lt;p&gt;For more information about recording rules and evaluation behavior, refer to the following resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/create-recording-rules/create-grafana-managed-recording-rules/&#34;&gt;Create Grafana-managed recording rules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rule-evaluation/evaluation-within-a-group/&#34;&gt;How rules are evaluated within a group&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>Rule sequences is currently in &lt;a href="/docs/release-life-cycle/">public preview&lt;/a>. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.&lt;/p></description></item><item><title>Template annotations and labels</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/templates/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/templates/</guid><content><![CDATA[&lt;h1 id=&#34;template-annotations-and-labels&#34;&gt;Template annotations and labels&lt;/h1&gt;
&lt;p&gt;You can use templates to customize alert and notification messages, including dynamic data from alert rule queries.&lt;/p&gt;
&lt;p&gt;In Grafana Alerting, you can template alert messages in two ways.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Template annotations and labels&lt;/strong&gt;: In the alert rule definition, you can template annotations and labels to include extra information from query data to the alert, adding meaningful details based on the query results.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Template notifications&lt;/strong&gt;: You can template notifications to control the content and appearance of your notifications.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;how-templating-works&#34;&gt;How templating works&lt;/h2&gt;
&lt;p&gt;In this diagram, you can see the differences between both types of templates.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1200px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/alerting/how-notification-templates-works.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/alerting/how-notification-templates-works.png&#34;data-srcset=&#34;/media/docs/alerting/how-notification-templates-works.png?w=320 320w, /media/docs/alerting/how-notification-templates-works.png?w=550 550w, /media/docs/alerting/how-notification-templates-works.png?w=750 750w, /media/docs/alerting/how-notification-templates-works.png?w=900 900w, /media/docs/alerting/how-notification-templates-works.png?w=1040 1040w, /media/docs/alerting/how-notification-templates-works.png?w=1240 1240w, /media/docs/alerting/how-notification-templates-works.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;How templating works&#34;width=&#34;1072&#34;height=&#34;699&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/alerting/how-notification-templates-works.png&#34;
            alt=&#34;How templating works&#34;width=&#34;1072&#34;height=&#34;699&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/templates/&#34;&gt;Templates Introduction&lt;/a&gt; for a more detailed explanation of this diagram.&lt;/p&gt;
&lt;p&gt;Both types of templates are written in the Go templating system. However, it&amp;rsquo;s important to understand that variables and functions used in notification templates are different from those used in annotation and label templates.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Template annotations and labels&lt;/strong&gt;: These templates add extra information to individual alert instances. Template variables like 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/templates/reference/#labels&#34;&gt;&lt;code&gt;$labels&lt;/code&gt;&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/templates/reference/#values&#34;&gt;&lt;code&gt;$values&lt;/code&gt;&lt;/a&gt; represent alert query data of the individual alert instance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Template notifications&lt;/strong&gt;: Notification templates format the notification content for a group of alerts. Variables like 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/template-notifications/reference/#notification-data&#34;&gt;&lt;code&gt;.Alerts&lt;/code&gt;&lt;/a&gt; include all firing and resolved alerts in the notification.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;template-annotations&#34;&gt;Template annotations&lt;/h2&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/#annotations&#34;&gt;Annotations&lt;/a&gt; add additional information to alert instances and are often used to help identify the alert and guide responders on how to address the issue.&lt;/p&gt;
&lt;p&gt;Annotations are key-value pairs defined in the alert rule. They can contain plain text or template code that is evaluated when the alert fires.&lt;/p&gt;
&lt;p&gt;Grafana includes several optional annotations, such as &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;summary&lt;/code&gt;, and &lt;code&gt;runbook_url&lt;/code&gt;, which can be edited in the alert rule. You can also create your custom annotations. For example, you might create a new annotation named &lt;code&gt;location&lt;/code&gt; to report the location of the system that triggered the alert.&lt;/p&gt;
&lt;p&gt;Here’s an example of a &lt;code&gt;summary&lt;/code&gt; annotation explaining why the alert was triggered, using plain text.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;CPU usage has exceeded 80% for the last 5 minutes.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;However, if you want to display dynamic query values in annotations, you need to use template code. Common use cases include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Displaying the query value that triggered the alert.&lt;/li&gt;
&lt;li&gt;Highlighting label information that identifies the alert, such as the environment, instance, or region.&lt;/li&gt;
&lt;li&gt;Providing specific instructions based on query values.&lt;/li&gt;
&lt;li&gt;Customizing runbook links depending on query labels.&lt;/li&gt;
&lt;li&gt;Including contact information based on query labels.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For instance, you can template the previous example to display the specific instance and CPU value that triggered the alert.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;CPU usage for {{ $labels.instance }} has exceeded 80% ({{ $values.A.Value }}) for the last 5 minutes.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Alternatively, you can use the &lt;code&gt;index&lt;/code&gt; function to print query values.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;CPU usage for {{ index $labels &amp;#34;instance&amp;#34; }} has exceeded 80% ({{ index $values &amp;#34;A&amp;#34; }}) for the last 5 minutes.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The result of the annotation would be as follows.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;CPU usage for Instance 1 has exceeded 80% (81.2345) for the last 5 minutes.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;how-to-template-an-annotation&#34;&gt;How to template an annotation&lt;/h3&gt;
&lt;p&gt;Complete the following steps to template an annotation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Alerts &amp;amp; IRM&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt; -&amp;gt; create or edit an alert rule.&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Configure notification message&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;Copy in your template in the corresponding annotation field (&lt;code&gt;summary&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;runbook_url&lt;/code&gt;, &lt;code&gt;custom&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;preview-annotation-templates&#34;&gt;Preview annotation templates&lt;/h3&gt;
&lt;p&gt;You can template annotations when creating or editing an alert rule.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1200px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/alerting/alert-rule-using-annotation-template.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/alerting/alert-rule-using-annotation-template.png&#34;data-srcset=&#34;/media/docs/alerting/alert-rule-using-annotation-template.png?w=320 320w, /media/docs/alerting/alert-rule-using-annotation-template.png?w=550 550w, /media/docs/alerting/alert-rule-using-annotation-template.png?w=750 750w, /media/docs/alerting/alert-rule-using-annotation-template.png?w=900 900w, /media/docs/alerting/alert-rule-using-annotation-template.png?w=1040 1040w, /media/docs/alerting/alert-rule-using-annotation-template.png?w=1240 1240w, /media/docs/alerting/alert-rule-using-annotation-template.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;An alert rule templating the annotation summary&#34;width=&#34;900&#34;height=&#34;498&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/alerting/alert-rule-using-annotation-template.png&#34;
            alt=&#34;An alert rule templating the annotation summary&#34;width=&#34;900&#34;height=&#34;498&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Two common methods are used to test and preview annotation templates:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Trigger the alert and 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/monitor-status/view-alert-state/&#34;&gt;view the alert instance state in the Grafana UI&lt;/a&gt;, where all annotations of the alert instance are displayed.&lt;/li&gt;
&lt;li&gt;Use a notification template that displays all annotations, then 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/configure-notifications/template-notifications/manage-notification-templates/#preview-notification-templates&#34;&gt;preview the notification template&lt;/a&gt; using the alert instance.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;template-labels&#34;&gt;Template labels&lt;/h2&gt;
&lt;p&gt;The set of 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/&#34;&gt;labels&lt;/a&gt; for an alert instance is used to uniquely identify that alert among all other alert instances.&lt;/p&gt;
&lt;p&gt;Labels determine how alerts are routed and managed for notifications, making their design key to the effectiveness of your alerting system.&lt;/p&gt;
&lt;p&gt;Labels can be returned from an alert rule query, such as the &lt;code&gt;pod&lt;/code&gt; label in a Kubernetes Prometheus query. You can also define additional labels in the alert rule to provide extra information for processing alerts.&lt;/p&gt;
&lt;p&gt;Like annotations, labels are key-value pairs that can contain plain text or template code evaluated when the alert fires.&lt;/p&gt;
&lt;p&gt;Template labels when the labels returned by your queries are insufficient. For instance:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A new label based on a query value can group a subset of alerts differently, changing how notifications are sent.&lt;/li&gt;
&lt;li&gt;A new label based on a query value can be used in a notification policy to alter the notification contact point.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s an example of templating a &lt;code&gt;severity&lt;/code&gt; label based on the query value.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Go&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-go&#34;&gt;{{ if (gt $values.A.Value 90.0) -}}
critical
{{ else if (gt $values.A.Value 80.0) -}}
high
{{ else if (gt $values.A.Value 60.0) -}}
medium
{{ else -}}
low
{{- end }}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, the value of the &lt;code&gt;severity&lt;/code&gt; label is determined by the query value, and the possible options are &lt;code&gt;critical&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, or &lt;code&gt;low&lt;/code&gt;. You can then use the &lt;code&gt;severity&lt;/code&gt; label to change their notifications—for instance, sending &lt;code&gt;critical&lt;/code&gt; alerts immediately or routing &lt;code&gt;low&lt;/code&gt; alerts to a specific team for further review.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; An alert instance is uniquely identified by its set of labels.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Avoid displaying query values in labels, as this can create numerous alert instances—one for each distinct label set. Instead, use annotations for query values.&lt;/li&gt;
&lt;li&gt;If a templated label&amp;rsquo;s value changes, it maps to a different alert instance, and the previous instance is considered &lt;strong&gt;stale&lt;/strong&gt;. Learn all the details in this 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/best-practices/dynamic-labels/&#34;&gt;example using dynamic labels&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;
&lt;h3 id=&#34;how-to-template-a-label&#34;&gt;How to template a label&lt;/h3&gt;
&lt;p&gt;Complete the following steps to template a label.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Alerts &amp;amp; IRM&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt; -&amp;gt; create or edit an alert rule.&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Configure labels and notifications&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&#43; Add labels&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a &lt;strong&gt;key&lt;/strong&gt; that identifies the label.&lt;/li&gt;
&lt;li&gt;Copy in your template in the &lt;strong&gt;value&lt;/strong&gt; field.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;preview-label-templates&#34;&gt;Preview label templates&lt;/h3&gt;
&lt;p&gt;You can template label values when creating or editing an alert rule.&lt;/p&gt;
&lt;p&gt;To preview label values, select &lt;code&gt;Use notification policy&lt;/code&gt;, and then click on &lt;code&gt;Preview routing&lt;/code&gt;.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1200px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/alerting/alert-instance-routing-preview.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/alerting/alert-instance-routing-preview.png&#34;data-srcset=&#34;/media/docs/alerting/alert-instance-routing-preview.png?w=320 320w, /media/docs/alerting/alert-instance-routing-preview.png?w=550 550w, /media/docs/alerting/alert-instance-routing-preview.png?w=750 750w, /media/docs/alerting/alert-instance-routing-preview.png?w=900 900w, /media/docs/alerting/alert-instance-routing-preview.png?w=1040 1040w, /media/docs/alerting/alert-instance-routing-preview.png?w=1240 1240w, /media/docs/alerting/alert-instance-routing-preview.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Routing preview displays label values&#34;width=&#34;2614&#34;height=&#34;1040&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/alerting/alert-instance-routing-preview.png&#34;
            alt=&#34;Routing preview displays label values&#34;width=&#34;2614&#34;height=&#34;1040&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h2 id=&#34;more-information&#34;&gt;More information&lt;/h2&gt;
&lt;p&gt;For further details on how to template alert rules, refer to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/templates/reference/&#34;&gt;Annotation and label template reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/alerting-rules/templates/examples/&#34;&gt;Annotation and label examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;For a practical example of templating, refer to our &lt;a href=&#34;/tutorials/alerting-get-started-pt4/&#34;&gt;Getting Started with Templating tutorial&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="template-annotations-and-labels">Template annotations and labels&lt;/h1>
&lt;p>You can use templates to customize alert and notification messages, including dynamic data from alert rule queries.&lt;/p>
&lt;p>In Grafana Alerting, you can template alert messages in two ways.&lt;/p></description></item><item><title>Improve alert rule quality with Alert Advisor</title><link>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/alert-rule-quality/</link><pubDate>Tue, 27 Oct 2026 11:15:42 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/alerting/alerting-rules/alert-rule-quality/</guid><content><![CDATA[&lt;h1 id=&#34;improve-alert-rule-quality-with-alert-advisor&#34;&gt;Improve alert rule quality with Alert Advisor&lt;/h1&gt;
&lt;p&gt;Alerts are easier to act on when they carry the right context.
A runbook URL helps you investigate an issue, and a team label helps you route your notifications.&lt;/p&gt;
&lt;p&gt;Alert Advisor checks your Grafana-managed alert rules against a quality policy of required labels and annotations, so you can find and fix rules that are missing that context.
With Alert Advisor, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Define which labels and annotations your Grafana-managed alert rules must have.&lt;/li&gt;
&lt;li&gt;Find rules that are missing required labels or annotations and update them.&lt;/li&gt;
&lt;li&gt;Optionally block supported provisioning writes that don&amp;rsquo;t meet selected requirements.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you begin, check that you have the following permissions in your Grafana organization:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rule access:&lt;/strong&gt; Have permission to view the Grafana-managed alert rules you want to assess.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Policy permissions:&lt;/strong&gt; To configure the quality policy, have the Admin role in your organization or a role with &lt;code&gt;alert.rules.quality:write&lt;/code&gt; and &lt;code&gt;alert.rules:read&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule updates:&lt;/strong&gt; To fix findings, have permission to update the affected rules.
For provisioned rules, you also need access to their source configuration and permission to reapply it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information about alerting permissions and folder access, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/configure-rbac/&#34;&gt;Configure RBAC&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;understand-policy-scope&#34;&gt;Understand policy scope&lt;/h2&gt;
&lt;p&gt;A single quality policy applies to Grafana-managed alert rules across folders in your organization.
Data source-managed alert rules and recording rules are excluded.&lt;/p&gt;
&lt;p&gt;Alert Advisor reports a finding when a required label or annotation is missing, empty, or contains only whitespace.
The checks do not validate the content itself, they only check for the presence of a particular field.
For example, requiring a runbook URL doesn&amp;rsquo;t check whether the link works.&lt;/p&gt;
&lt;h3 id=&#34;detection-and-enforcement&#34;&gt;Detection and enforcement&lt;/h3&gt;
&lt;p&gt;You choose a mode for each requirement:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Mode&lt;/th&gt;
              &lt;th&gt;Behavior&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Detect-only&lt;/td&gt;
              &lt;td&gt;Missing values appear as findings but don&amp;rsquo;t block rule creation or updates.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Enforced&lt;/td&gt;
              &lt;td&gt;Missing values appear as findings and block rule creation or updates through supported provisioning paths.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Both modes contribute to the quality score.
Enabling enforcement doesn&amp;rsquo;t stop existing rules from evaluating or sending notifications.&lt;/p&gt;
&lt;h3 id=&#34;supported-enforcement-paths&#34;&gt;Supported enforcement paths&lt;/h3&gt;
&lt;p&gt;Enforcement applies to provisioned rules created or updated through Terraform and the Alerting provisioning HTTP API, with the following exceptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provisioning API requests that set the &lt;code&gt;X-Disable-Provenance&lt;/code&gt; header, including Terraform &lt;code&gt;grafana_rule_group&lt;/code&gt; resources with &lt;code&gt;disable_provenance = true&lt;/code&gt;, aren&amp;rsquo;t enforced.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubectl&lt;/code&gt; writes are enforced only when the manifest sets &lt;code&gt;grafana.app/managedBy&lt;/code&gt; to &lt;code&gt;kubectl&lt;/code&gt; or &lt;code&gt;terraform&lt;/code&gt; together with a non-empty &lt;code&gt;grafana.app/managerId&lt;/code&gt;, or sets &lt;code&gt;grafana.com/provenance&lt;/code&gt; to &lt;code&gt;api&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Writes from the Grafana rule editor aren&amp;rsquo;t enforced, but the resulting rules can still have quality findings.&lt;/p&gt;
&lt;h2 id=&#34;configure-a-quality-policy&#34;&gt;Configure a quality policy&lt;/h2&gt;
&lt;p&gt;Start with detect-only requirements to identify missing information before enabling enforcement.
The following example requires a runbook URL and a &lt;code&gt;team&lt;/code&gt; label.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Quality policy settings&lt;/strong&gt; button is visible only if you have the policy permissions listed in &lt;a href=&#34;#before-you-begin&#34;&gt;Before you begin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To configure a quality policy, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;Alerting&lt;/strong&gt; &amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt; and select &lt;strong&gt;Alert quality&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Quality policy settings&lt;/strong&gt; (the cog icon) to open the &lt;strong&gt;Quality policy&lt;/strong&gt; drawer.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under &lt;strong&gt;Required annotations&lt;/strong&gt;, turn on &lt;strong&gt;Runbook URL&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You can also require &lt;strong&gt;Summary&lt;/strong&gt; and &lt;strong&gt;Description&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under &lt;strong&gt;Required labels&lt;/strong&gt;, enter &lt;code&gt;team&lt;/code&gt; in &lt;strong&gt;Label keys&lt;/strong&gt; and select the matching option.&lt;/p&gt;
&lt;p&gt;You can select keys already used by your rules or add a new key.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Keep &lt;strong&gt;Enforce&lt;/strong&gt; off for the requirements you add.&lt;/p&gt;
&lt;p&gt;New requirements start in detect-only mode.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Grafana displays &lt;strong&gt;Policy saved&lt;/strong&gt; to confirm the change.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The saved policy identifies rules with missing or empty &lt;code&gt;runbook_url&lt;/code&gt; annotations or &lt;code&gt;team&lt;/code&gt; labels.&lt;/p&gt;
&lt;p&gt;A policy with no required annotations or labels checks nothing.&lt;/p&gt;
&lt;h2 id=&#34;review-alert-quality&#34;&gt;Review alert quality&lt;/h2&gt;
&lt;p&gt;In Alert Advisor, the &lt;strong&gt;Alert quality&lt;/strong&gt; tab lists rules that don&amp;rsquo;t meet your policy and shows an overall quality score.&lt;/p&gt;
&lt;p&gt;To review the findings, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Alerting&lt;/strong&gt; &amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt; and select &lt;strong&gt;Alert quality&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Review the &lt;strong&gt;Alert quality score&lt;/strong&gt; and the number of rules that need attention.&lt;/li&gt;
&lt;li&gt;Inspect the missing annotations and labels in the &lt;strong&gt;Findings&lt;/strong&gt; list.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each missing field appears as a badge. To check whether a requirement is enforced or detect-only, hover over its badge.&lt;/p&gt;
&lt;h3 id=&#34;understand-the-score&#34;&gt;Understand the score&lt;/h3&gt;
&lt;p&gt;The score represents the proportion of assessed rules that meet every configured requirement, on a scale of 0 to 10.
For example, if 8 of 10 rules meet the policy, the score is 8.0.
Grafana rounds the score to one decimal place.&lt;/p&gt;
&lt;p&gt;The score measures compliance with your policy, not alert accuracy, severity, or noise. Both detect-only and enforced requirements count toward the score.&lt;/p&gt;
&lt;p&gt;Your permissions determine which rules you can view and assess.
Search filters change the findings&amp;rsquo; list, not the score or the total rule count.
Grafana also displays 10.0 when there are no rules to assess, so check the rule count alongside the score.&lt;/p&gt;
&lt;h2 id=&#34;resolve-quality-findings&#34;&gt;Resolve quality findings&lt;/h2&gt;
&lt;p&gt;Add meaningful values for the missing fields in each rule.
For the example policy, set &lt;code&gt;runbook_url&lt;/code&gt; to the rule&amp;rsquo;s runbook URL and &lt;code&gt;team&lt;/code&gt; to the owning team&amp;rsquo;s name.&lt;/p&gt;
&lt;p&gt;Changing label values can affect notification routing.
Choose values that match your team&amp;rsquo;s 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/notifications/notification-policies/&#34;&gt;notification policies&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;update-provisioned-rules&#34;&gt;Update provisioned rules&lt;/h3&gt;
&lt;p&gt;For provisioned rules, make changes in the source configuration so they remain part of your provisioning workflow.&lt;/p&gt;
&lt;p&gt;To resolve a finding on a provisioned rule, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Locate the rule in its source configuration, using the rule name, folder, and group shown in &lt;strong&gt;Alert quality&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add values for the missing annotations and labels.&lt;/li&gt;
&lt;li&gt;Reapply the configuration through your usual provisioning workflow.&lt;/li&gt;
&lt;li&gt;Reload the &lt;strong&gt;Alert quality&lt;/strong&gt; page and check the rule&amp;rsquo;s findings.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A rule disappears from the findings list when it meets every configured requirement.
If other required fields are still missing, the rule remains in the list with those findings.&lt;/p&gt;
&lt;h3 id=&#34;update-rules-in-grafana&#34;&gt;Update rules in Grafana&lt;/h3&gt;
&lt;p&gt;For rules that you can edit in Grafana, use the &lt;strong&gt;Edit&lt;/strong&gt; action on the quality page.&lt;/p&gt;
&lt;p&gt;To resolve a finding in the rule editor, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Edit&lt;/strong&gt; for the affected rule.&lt;/li&gt;
&lt;li&gt;Fill in the missing annotations and labels in the rule editor.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Return to &lt;strong&gt;Alert quality&lt;/strong&gt; and reload the page to check the findings.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;optional-enforce-quality-requirements&#34;&gt;Optional: Enforce quality requirements&lt;/h2&gt;
&lt;p&gt;After reviewing and resolving findings, enable enforcement for the requirements you want to apply to supported provisioning writes.
You can enforce selected requirements while keeping others detect-only.&lt;/p&gt;
&lt;p&gt;To enable enforcement, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;On the &lt;strong&gt;Alert quality&lt;/strong&gt; page, click &lt;strong&gt;Quality policy settings&lt;/strong&gt; (the cog icon) to open the &lt;strong&gt;Quality policy&lt;/strong&gt; drawer.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn on &lt;strong&gt;Enforce&lt;/strong&gt; beside each requirement you want to enforce.&lt;/p&gt;
&lt;p&gt;For example, enforce &lt;code&gt;team&lt;/code&gt; while keeping &lt;strong&gt;Runbook URL&lt;/strong&gt; detect-only.
To enforce all currently configured requirements, turn on &lt;strong&gt;Enforce all requirements&lt;/strong&gt; instead.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Grafana displays &lt;strong&gt;Policy saved&lt;/strong&gt; to confirm the change.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;disable-enforcement-or-remove-a-requirement&#34;&gt;Disable enforcement or remove a requirement&lt;/h3&gt;
&lt;p&gt;To return a requirement to detect-only, turn off its &lt;strong&gt;Enforce&lt;/strong&gt; control (or &lt;strong&gt;Enforce all requirements&lt;/strong&gt;, if every requirement is enforced) and click &lt;strong&gt;Save&lt;/strong&gt;.
The requirement remains in the policy and continues to affect the quality score.&lt;/p&gt;
&lt;p&gt;To stop checking a field altogether, remove its requirement instead: turn off its switch under &lt;strong&gt;Required annotations&lt;/strong&gt;, or remove its key from &lt;strong&gt;Label keys&lt;/strong&gt;. Then click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;troubleshoot-quality-findings-and-rejected-writes&#34;&gt;Troubleshoot quality findings and rejected writes&lt;/h2&gt;
&lt;p&gt;Use the following guidance when you can&amp;rsquo;t access the feature, resolve a finding, or apply a rule change.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Symptom&lt;/th&gt;
              &lt;th&gt;Action&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Alert quality&lt;/strong&gt; or the &lt;strong&gt;Quality policy settings&lt;/strong&gt; button isn&amp;rsquo;t visible.&lt;/td&gt;
              &lt;td&gt;Ask your stack administrator to check your &lt;a href=&#34;#before-you-begin&#34;&gt;permissions&lt;/a&gt; and the feature&amp;rsquo;s availability in your stack.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;A rule has no &lt;strong&gt;Edit&lt;/strong&gt; action.&lt;/td&gt;
              &lt;td&gt;If it has a &lt;strong&gt;Provisioned&lt;/strong&gt; badge, update its source configuration. Otherwise, check your permission to update rules in that folder.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Grafana reports that no quality policy is configured.&lt;/td&gt;
              &lt;td&gt;Add at least one requirement in the &lt;strong&gt;Quality policy&lt;/strong&gt; drawer and click &lt;strong&gt;Save&lt;/strong&gt;. An empty policy doesn&amp;rsquo;t assess any fields.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;No findings match your search, but the score is below 10.0.&lt;/td&gt;
              &lt;td&gt;Clear &lt;strong&gt;Search&lt;/strong&gt; to view all findings. Search filters don&amp;rsquo;t change the score.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;A finding remains after enforcement is disabled.&lt;/td&gt;
              &lt;td&gt;Detect-only requirements still produce findings. Fill in the missing value or remove the requirement from the policy.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;A provisioning write is rejected by the quality policy.&lt;/td&gt;
              &lt;td&gt;Use the rule and field details in the error to update the source configuration, then reapply it.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;A write succeeds despite a quality finding.&lt;/td&gt;
              &lt;td&gt;Check that the requirement is enforced and the policy is saved. Confirm that the write uses a &lt;a href=&#34;#supported-enforcement-paths&#34;&gt;supported enforcement path&lt;/a&gt; and isn&amp;rsquo;t one of its exceptions.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;Use these guides to improve rule context, manage rules as code, and configure access:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rule context:&lt;/strong&gt; 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/fundamentals/alert-rules/annotation-label/&#34;&gt;Labels and annotations&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Provisioning:&lt;/strong&gt; 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/provision-alerting-resources/terraform-provisioning/&#34;&gt;Use Terraform to provision alerting resources&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API management:&lt;/strong&gt; 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/provision-alerting-resources/http-api-provisioning/&#34;&gt;Use the HTTP API to manage alerting resources&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Permissions:&lt;/strong&gt; 
    &lt;a href=&#34;/docs/grafana/v13.3/alerting/set-up/configure-rbac/&#34;&gt;Configure RBAC&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="improve-alert-rule-quality-with-alert-advisor">Improve alert rule quality with Alert Advisor&lt;/h1>
&lt;p>Alerts are easier to act on when they carry the right context.
A runbook URL helps you investigate an issue, and a team label helps you route your notifications.&lt;/p></description></item></channel></rss>