<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Name and query on Grafana Labs</title><link>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/</link><description>Recent content in Name and query on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/learning-hub/basic-alerting/02-name-and-query/index.xml" rel="self" type="application/rss+xml"/><item><title>What is an alert rule</title><link>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/05-what-is-alert-rule/</link><pubDate>Mon, 10 Aug 2026 13:40:40 -0500</pubDate><guid>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/05-what-is-alert-rule/</guid><content><![CDATA[&lt;h2 id=&#34;what-is-an-alert-rule&#34;&gt;What is an alert rule&lt;/h2&gt;
&lt;p&gt;An &lt;strong&gt;alert rule&lt;/strong&gt; tells Grafana what data to watch. It defines a threshold for when something becomes a problem, and it defines what to do when something goes wrong and an alert is triggered. You create an alert by completing the &lt;strong&gt;New alert rule&lt;/strong&gt; page in the UI, where you fill out the following sections:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Section&lt;/th&gt;
              &lt;th&gt;What you set up&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Alert rule name&lt;/td&gt;
              &lt;td&gt;A descriptive name so your team knows what fired&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Query and condition&lt;/td&gt;
              &lt;td&gt;Which data to watch and what &amp;ldquo;too high&amp;rdquo; or &amp;ldquo;too low&amp;rdquo; means&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Folder and labels&lt;/td&gt;
              &lt;td&gt;Where to store the rule and how to tag it&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Evaluation behavior&lt;/td&gt;
              &lt;td&gt;How often Grafana checks and how long to wait before alerting&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Notifications&lt;/td&gt;
              &lt;td&gt;Where to send the notification when something goes wrong&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;
&lt;div class=&#34;learning-hub-image&#34;&gt;
  &lt;a href=&#34;alert-rule-anatomy.svg&#34; title=&#34;Diagram of an alert rule made of a name plus five sections: query and condition, folder and labels, evaluation behavior, and notifications&#34;&gt;
    &lt;img
      class=&#34;lazyload d-inline-block&#34;
      data-src=&#34;alert-rule-anatomy.svg&#34;
      alt=&#34;Diagram of an alert rule made of a name plus five sections: query and condition, folder and labels, evaluation behavior, and notifications&#34; width=&#34;800&#34; height=&#34;300&#34;/&gt;
    &lt;div class=&#34;learning-hub-image__zoom&#34;&gt;
      &lt;svg width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
        &lt;path d=&#34;M21 21L15 15M17 10C17 13.866 13.866 17 10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10Z&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
        &lt;path d=&#34;M10 7V13M7 10H13&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;/&gt;
      &lt;/svg&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2 id=&#34;why-the-name-matters&#34;&gt;Why the name matters&lt;/h2&gt;
&lt;p&gt;The alert rule name shows up in &lt;em&gt;every&lt;/em&gt; notification your team receives. A vague name like &amp;ldquo;Alert 1&amp;rdquo; tells the responder nothing about what&amp;rsquo;s wrong. Your alert rule name is the first piece of critical information a responder will see, so a clear naming structure for your alerts helps responders act faster.&lt;/p&gt;
&lt;p&gt;Choose names that describe &lt;strong&gt;what&lt;/strong&gt; you&amp;rsquo;re monitoring and &lt;strong&gt;where&lt;/strong&gt;, for example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;QuickPizza server errors&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Payment service error rate above 5%&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Database connection pool exhausted&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h2 id="what-is-an-alert-rule">What is an alert rule&lt;/h2>
&lt;p>An &lt;strong>alert rule&lt;/strong> tells Grafana what data to watch. It defines a threshold for when something becomes a problem, and it defines what to do when something goes wrong and an alert is triggered. You create an alert by completing the &lt;strong>New alert rule&lt;/strong> page in the UI, where you fill out the following sections:&lt;/p></description></item><item><title>Queries</title><link>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/06-queries/</link><pubDate>Mon, 10 Aug 2026 13:40:40 -0500</pubDate><guid>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/06-queries/</guid><content><![CDATA[&lt;h2 id=&#34;queries&#34;&gt;Queries&lt;/h2&gt;
&lt;p&gt;Queries tell the alert where to look for data, what metric to choose, and what time series to look at specifically.&lt;/p&gt;
&lt;p&gt;Grafana Alerting can query many data sources, not only metrics. You can also alert on logs and other signals when the data source supports alerting. This journey focuses on metrics.&lt;/p&gt;
&lt;h2 id=&#34;two-ways-to-write-a-query&#34;&gt;Two ways to write a query&lt;/h2&gt;
&lt;p&gt;The Prometheus query editor has two options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Builder&lt;/strong&gt; method: Lets you construct the query visually by picking the metric and operations from menus&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Code&lt;/strong&gt; method: For writing PromQL by hand, which is more powerful but harder if you&amp;rsquo;re new to the language&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This journey starts with &lt;strong&gt;Builder&lt;/strong&gt; because it&amp;rsquo;s the simplest way to build a query without learning PromQL. Everything Builder does maps to PromQL behind the scenes, so when you flip to the &lt;strong&gt;Code&lt;/strong&gt; tab, you can see the generated PromQL query.&lt;/p&gt;
&lt;h2 id=&#34;overview-of-query-components&#34;&gt;Overview of query components&lt;/h2&gt;
&lt;p&gt;You want to alert when the QuickPizza app returns server errors (HTTP 5xx responses). Your query will use these pieces:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The tutorial Prometheus data source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data source&lt;/strong&gt;: &lt;code&gt;grafanacloud-play-prom&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A counter that tracks HTTP requests. Each time QuickPizza handles a request, this number grows, and each series carries a response &lt;strong&gt;status&lt;/strong&gt; label:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Metric&lt;/strong&gt;: &lt;code&gt;quickpizza_server_http_requests_total&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A label filter that matches every 5xx status code in one expression:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Label filter&lt;/strong&gt;: &lt;code&gt;status =~ &amp;quot;5..&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A way to count new errors over the last five minutes (counters only go up, so you need a range function), and optionally a sum so the alert uses one total across services:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Operation: Increase&lt;/strong&gt; (over &lt;code&gt;5m&lt;/code&gt;), then optionally &lt;strong&gt;Sum&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With the Builder method, that becomes a query equivalent to &lt;code&gt;sum(increase(quickpizza_server_http_requests_total{status=~&amp;quot;5..&amp;quot;}[5m]))&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The exact metric and labels depend on your data source. In the hands-on path, you build this query for the QuickPizza app. The steps you follow, including picking a data source, choosing a metric, filtering, transforming, and previewing, are the same steps you&amp;rsquo;ll use on your own Prometheus-compatible metrics later.&lt;/p&gt;
&lt;h2 id=&#34;always-preview&#34;&gt;Always preview&lt;/h2&gt;
&lt;p&gt;Always preview your query before moving on. The preview is your proof the alert is watching real data.&lt;/p&gt;
&lt;p&gt;For QuickPizza, the preview shows how many 5xx responses arrived in the last five minutes. If you skip previewing and the query is empty or wrong, the rule still saves, but it &lt;em&gt;never fires&lt;/em&gt; on the condition you care about. You could walk away thinking the service is covered, and then during a real incident the alert you built stays silent.&lt;/p&gt;
]]></content><description>&lt;h2 id="queries">Queries&lt;/h2>
&lt;p>Queries tell the alert where to look for data, what metric to choose, and what time series to look at specifically.&lt;/p>
&lt;p>Grafana Alerting can query many data sources, not only metrics. You can also alert on logs and other signals when the data source supports alerting. This journey focuses on metrics.&lt;/p></description></item><item><title>Alert condition</title><link>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/07-alert-condition/</link><pubDate>Mon, 10 Aug 2026 13:40:40 -0500</pubDate><guid>https://grafana.com/docs/learning-hub/basic-alerting/02-name-and-query/07-alert-condition/</guid><content><![CDATA[&lt;h2 id=&#34;alert-condition&#34;&gt;Alert condition&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;alert condition&lt;/strong&gt; defines when an alert moves toward firing. A &lt;strong&gt;threshold&lt;/strong&gt; is the value the condition compares against.&lt;/p&gt;
&lt;p&gt;The condition watches a value over time. If the value stays at or below the threshold, the alert stays normal. When it rises above the threshold and stays there through the pending period you configure later, the alert fires.&lt;/p&gt;
&lt;p&gt;For this journey&amp;rsquo;s QuickPizza server-errors example, the value is how many new 5xx responses arrived in the last five minutes. Alert when that count &lt;strong&gt;is above 0&lt;/strong&gt; so any server errors in the window can trigger the rule. The alert condition has two parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Is above&lt;/strong&gt; is the operator.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;0&lt;/strong&gt; is the threshold.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;learning-hub-image&#34;&gt;
  &lt;a href=&#34;condition-flow.svg&#34; title=&#34;Line chart of QuickPizza 5xx responses over five-minute windows — near zero when healthy, spiking when errors appear — with a dashed threshold line at 0; the alert is normal at zero and moves toward firing while the value is above it&#34;&gt;
    &lt;img
      class=&#34;lazyload d-inline-block&#34;
      data-src=&#34;condition-flow.svg&#34;
      alt=&#34;Line chart of QuickPizza 5xx responses over five-minute windows — near zero when healthy, spiking when errors appear — with a dashed threshold line at 0; the alert is normal at zero and moves toward firing while the value is above it&#34; width=&#34;800&#34; height=&#34;260&#34;/&gt;
    &lt;div class=&#34;learning-hub-image__zoom&#34;&gt;
      &lt;svg width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
        &lt;path d=&#34;M21 21L15 15M17 10C17 13.866 13.866 17 10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10Z&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
        &lt;path d=&#34;M10 7V13M7 10H13&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34;/&gt;
      &lt;/svg&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2 id=&#34;important-verify-after-setting&#34;&gt;Important: verify after setting&lt;/h2&gt;
&lt;p&gt;Always click &lt;strong&gt;Preview alert rule condition&lt;/strong&gt; to verify which instances would fire. If you change the operator from &lt;strong&gt;Is above&lt;/strong&gt; to &lt;strong&gt;Is below&lt;/strong&gt;, double-check that the threshold value still makes sense.&lt;/p&gt;
]]></content><description>&lt;h2 id="alert-condition">Alert condition&lt;/h2>
&lt;p>The &lt;strong>alert condition&lt;/strong> defines when an alert moves toward firing. A &lt;strong>threshold&lt;/strong> is the value the condition compares against.&lt;/p>
&lt;p>The condition watches a value over time. If the value stays at or below the threshold, the alert stays normal. When it rises above the threshold and stays there through the pending period you configure later, the alert fires.&lt;/p></description></item></channel></rss>