<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Prometheus data source on Grafana Labs</title><link>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/</link><description>Recent content in Prometheus data source on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v10.1/datasources/prometheus/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure the Prometheus data source</title><link>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/configure-prometheus-data-source/</link><pubDate>Fri, 07 Mar 2025 11:34:44 +0100</pubDate><guid>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/configure-prometheus-data-source/</guid><content><![CDATA[&lt;h1 id=&#34;configure-prometheus&#34;&gt;Configure Prometheus&lt;/h1&gt;
&lt;p&gt;Grafana ships with built-in support for Prometheus. If you are new to Prometheus the following documentation will help you get started working with Prometheus and Grafana:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana/v10.1/fundamentals/intro-to-prometheus/&#34;&gt;What is Prometheus?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/concepts/data_model/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus data model&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/getting_started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Getting started&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-the-data-source&#34;&gt;Configure the data source&lt;/h2&gt;
&lt;p&gt;To add the Prometheus data source, complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Connections&lt;/strong&gt; in the left-side menu.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Connections&lt;/strong&gt;, click &lt;strong&gt;Add new connection&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;Prometheus&lt;/code&gt; in the search bar.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Prometheus data source&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create a Prometheus data source&lt;/strong&gt; in the upper right.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You will be taken to the &lt;strong&gt;Settings&lt;/strong&gt; tab where you will set up your Prometheus configuration.&lt;/p&gt;
&lt;h2 id=&#34;configuration-options&#34;&gt;Configuration options&lt;/h2&gt;
&lt;p&gt;The following is a list of configuration options for Prometheus.&lt;/p&gt;
&lt;p&gt;The first option to configure is the name of your connection:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Name&lt;/strong&gt; - The data source name. This is how you refer to the data source in panels and queries. Examples: prometheus-1, prom-metrics.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Default&lt;/strong&gt; - Toggle to select as the default name in dashboard panels. When you go to a dashboard panel this will be the default selected data source.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;http-section&#34;&gt;HTTP section&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;URL&lt;/strong&gt; - The URL of your Prometheus server. If your Prometheus server is local, use &lt;code&gt;&amp;lt;http://localhost:9090&amp;gt;&lt;/code&gt;. If it is on a server within a network, this is the URL with port where you are running Prometheus. Example: &lt;code&gt;&amp;lt;http://prometheus.example.orgname:9090&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Allowed cookies&lt;/strong&gt; - Specify cookies by name that should be forwarded to the data source. The Grafana proxy deletes all forwarded cookies by default.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Timeout&lt;/strong&gt; - The HTTP request timeout. This must be in seconds. There is no default, so this setting is up to you.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;auth-section&#34;&gt;Auth section&lt;/h3&gt;
&lt;p&gt;There are several authentication methods you can choose in the Authentication section.&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;Use TLS (Transport Layer Security) for an additional layer of security when working with Prometheus. For information on setting up TLS encryption with Prometheus see &lt;a href=&#34;https://prometheus.io/docs/guides/tls-encryption/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Securing Prometheus API and UI Endpoints Using TLS Encryption&lt;/a&gt;. You must add TLS settings to your Prometheus configuration file &lt;strong&gt;prior&lt;/strong&gt; to setting these options in Grafana.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Basic authentication&lt;/strong&gt; - The most common authentication method. Use your &lt;code&gt;data source&lt;/code&gt; user name and &lt;code&gt;data source&lt;/code&gt; password to connect.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;With credentials&lt;/strong&gt; - Toggle on to enable credentials such as cookies or auth headers to be sent with cross-site requests.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;TLS client authentication&lt;/strong&gt; - Toggle on to use client authentication. When enabled, add the &lt;code&gt;Server name&lt;/code&gt;, &lt;code&gt;Client cert&lt;/code&gt; and &lt;code&gt;Client key&lt;/code&gt;. The client provides a certificate that is validated by the server to establish the client&amp;rsquo;s trusted identity. The client key encrypts the data between client and server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;With CA cert&lt;/strong&gt; - Authenticate with a CA certificate. Follow the instructions of the CA (Certificate Authority) to download the certificate file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Skip TLS verify&lt;/strong&gt; - Toggle on to bypass TLS certificate validation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Forward OAuth identity&lt;/strong&gt; - Forward the OAuth access token (and also the OIDC ID token if available) of the user querying the data source.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;custom-http-headers&#34;&gt;Custom HTTP headers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Header&lt;/strong&gt; - Add a custom header. This allows custom headers to be passed based on the needs of your Prometheus instance.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Value&lt;/strong&gt; - The value of the header.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;additional-settings&#34;&gt;Additional settings&lt;/h2&gt;
&lt;p&gt;Following are additional configuration options.&lt;/p&gt;
&lt;h3 id=&#34;alerting&#34;&gt;Alerting&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Manage alerts via Alerting UI&lt;/strong&gt; - Toggle to enable &lt;code&gt;Alertmanager&lt;/code&gt; integration for this data source.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;interval-behavior&#34;&gt;Interval behavior&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Scrape interval&lt;/strong&gt; - Set this to the typical scrape and evaluation interval configured in Prometheus. The default is &lt;code&gt;15s&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Query timeout&lt;/strong&gt; - The default is &lt;code&gt;60s&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;query-editor&#34;&gt;Query editor&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Default editor&lt;/strong&gt; - Sets a default editor. Options are &lt;code&gt;Builder&lt;/code&gt; or &lt;code&gt;Code&lt;/code&gt;. For information on query editor types see &lt;a href=&#34;../query-editor/&#34;&gt;Prometheus query editor&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Disable metrics lookup&lt;/strong&gt; - Toggle on to disable the metrics chooser and metric/label support in the query field&amp;rsquo;s autocomplete. This helps if you have performance issues with large Prometheus instances.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;performance&#34;&gt;Performance&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Prometheus type&lt;/strong&gt; - The type of your Prometheus server. There are four options: &lt;code&gt;Prometheus&lt;/code&gt;, &lt;code&gt;Cortex&lt;/code&gt;, &lt;code&gt;Thanos&lt;/code&gt;, &lt;code&gt;Mimir&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Version&lt;/strong&gt; Select the version you are using. Once the Prometheus type has been selected, a list of versions auto-populates using the Prometheus &lt;a href=&#34;https://semver.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;buildinfo&lt;/a&gt; API. The &lt;code&gt;Cortex&lt;/code&gt; Prometheus type does not support this API so you will need to manually add the version.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Incremental querying (beta)&lt;/strong&gt; - Changes the default behavior of relative queries to always request fresh data from the Prometheus instance. Enable this option to decrease database and network load.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;other&#34;&gt;Other&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Custom query parameters&lt;/strong&gt; - Add custom parameters to the Prometheus query URL. For example &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;partial_response&lt;/code&gt;, &lt;code&gt;dedup&lt;/code&gt;, or &lt;code&gt;max_source_resolution&lt;/code&gt;. Multiple parameters should be concatenated together with an &amp;lsquo;&amp;amp;&amp;rsquo;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;HTTP method&lt;/strong&gt; - Use either &lt;code&gt;POST&lt;/code&gt; or &lt;code&gt;GET&lt;/code&gt; HTTP method to query your data source. &lt;code&gt;POST&lt;/code&gt; is the recommended and pre-selected method as it allows bigger queries. Change to &lt;code&gt;GET&lt;/code&gt; if you have a Prometheus version older than 2.1 or if &lt;code&gt;POST&lt;/code&gt; requests are restricted in your network.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exemplars&#34;&gt;Exemplars&lt;/h3&gt;
&lt;p&gt;Support for exemplars is available only for the Prometheus data source. If this is your first time working with exemplars see &lt;a href=&#34;/docs/grafana/v10.1/fundamentals/exemplars/&#34;&gt;Introduction to exemplars&lt;/a&gt;. An exemplar is a specific trace representative of measurement taken in a given time interval.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Internal link&lt;/strong&gt; - Toggle on to enable an internal link. When enabled, reveals the data source selector. Select the backend tracing data store for your exemplar data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;URL&lt;/strong&gt; - &lt;em&gt;(Visible if you &lt;strong&gt;disable&lt;/strong&gt; &lt;code&gt;Internal link&lt;/code&gt;)&lt;/em&gt; Defines the external link&amp;rsquo;s URL trace backend. You can interpolate the value from the field by using the &lt;a href=&#34;/docs/grafana/v10.1/panels-visualizations/configure-data-links/#value-variables&#34;&gt;&lt;code&gt;${__value.raw}&lt;/code&gt; macro&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data source&lt;/strong&gt; - &lt;em&gt;(Visible if you &lt;strong&gt;enable&lt;/strong&gt; &lt;code&gt;Internal link&lt;/code&gt;)&lt;/em&gt; The data source the exemplar will navigate to.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;URL label&lt;/strong&gt; - Adds a custom display label to override the value of the &lt;code&gt;Label name&lt;/code&gt; field.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Label name&lt;/strong&gt; - The name of the field in the &lt;code&gt;labels&lt;/code&gt; object used to obtain the traceID property.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Remove exemplar link&lt;/strong&gt; - Click to remove existing links.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="configure-prometheus">Configure Prometheus&lt;/h1>
&lt;p>Grafana ships with built-in support for Prometheus. If you are new to Prometheus the following documentation will help you get started working with Prometheus and Grafana:&lt;/p></description></item><item><title>Prometheus query editor</title><link>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/query-editor/</link><pubDate>Thu, 12 Oct 2023 15:23:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/query-editor/</guid><content><![CDATA[&lt;h1 id=&#34;prometheus-query-editor&#34;&gt;Prometheus query editor&lt;/h1&gt;
&lt;p&gt;Grafana provides a query editor for the Prometheus data source to create queries in PromQL. For more information about PromQL, see &lt;a href=&#34;http://prometheus.io/docs/querying/basics/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Querying Prometheus&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For general documentation on querying data sources in Grafana, see &lt;a href=&#34;/docs/grafana/v10.1/panels-visualizations/query-transform-data/&#34;&gt;Query and transform data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For options and functions common to all query editors, see &lt;a href=&#34;/docs/grafana/v10.1/panels-visualizations/query-transform-data/&#34;&gt;Query editors&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;choose-a-query-editing-mode&#34;&gt;Choose a query editing mode&lt;/h2&gt;
&lt;p&gt;The Prometheus query editor has two modes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#builder-mode&#34;&gt;Builder mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-mode&#34;&gt;Code mode&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Each mode is explained in greater detail below.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/editing-mode.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;/static/img/docs/prometheus/editing-mode.png&#34;data-srcset=&#34;/static/img/docs/prometheus/editing-mode.png?w=320 320w, /static/img/docs/prometheus/editing-mode.png?w=550 550w, /static/img/docs/prometheus/editing-mode.png?w=750 750w, /static/img/docs/prometheus/editing-mode.png?w=900 900w, /static/img/docs/prometheus/editing-mode.png?w=1040 1040w, /static/img/docs/prometheus/editing-mode.png?w=1240 1240w, /static/img/docs/prometheus/editing-mode.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Query editor mode&#34;width=&#34;1703&#34;height=&#34;43&#34;title=&#34;Query editor mode&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/editing-mode.png&#34;
            alt=&#34;Query editor mode&#34;width=&#34;1703&#34;height=&#34;43&#34;title=&#34;Query editor mode&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Query editor mode&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Both modes are synchronized, so you can switch between them. However, if there is an issue with the query while switching modes, a warning message will appear.&lt;/p&gt;
&lt;h2 id=&#34;toolbar-elements&#34;&gt;Toolbar elements&lt;/h2&gt;
&lt;p&gt;The query editor toolbar contains the following elements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Kick start your query&lt;/strong&gt; - Click to see a list of operation patterns that help you quickly get started adding multiple operations to your query. These include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rate query starters&lt;/li&gt;
&lt;li&gt;Histogram query starters&lt;/li&gt;
&lt;li&gt;Binary query starters&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Click the arrow next to each to see available options to add to your query.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Explain&lt;/strong&gt; - Toggle to display a step-by-step explanation of all query components and operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/explain-results.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;/static/img/docs/prometheus/explain-results.png&#34;data-srcset=&#34;/static/img/docs/prometheus/explain-results.png?w=320 320w, /static/img/docs/prometheus/explain-results.png?w=550 550w, /static/img/docs/prometheus/explain-results.png?w=750 750w, /static/img/docs/prometheus/explain-results.png?w=900 900w, /static/img/docs/prometheus/explain-results.png?w=1040 1040w, /static/img/docs/prometheus/explain-results.png?w=1240 1240w, /static/img/docs/prometheus/explain-results.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Explain results&#34;width=&#34;1673&#34;height=&#34;366&#34;title=&#34;Explain results&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/explain-results.png&#34;
            alt=&#34;Explain results&#34;width=&#34;1673&#34;height=&#34;366&#34;title=&#34;Explain results&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Explain results&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Builder/Code&lt;/strong&gt; - Click the corresponding &lt;strong&gt;Builder&lt;/strong&gt; or &lt;strong&gt;Code&lt;/strong&gt; tab on the toolbar to select a editor mode.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-common-options&#34;&gt;Configure common options&lt;/h2&gt;
&lt;p&gt;You can configure Prometheus-specific options in the query editor by setting several options regardless of mode.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/options.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;/static/img/docs/prometheus/options.png&#34;data-srcset=&#34;/static/img/docs/prometheus/options.png?w=320 320w, /static/img/docs/prometheus/options.png?w=550 550w, /static/img/docs/prometheus/options.png?w=750 750w, /static/img/docs/prometheus/options.png?w=900 900w, /static/img/docs/prometheus/options.png?w=1040 1040w, /static/img/docs/prometheus/options.png?w=1240 1240w, /static/img/docs/prometheus/options.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Options&#34;width=&#34;820&#34;height=&#34;114&#34;title=&#34;Options&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/options.png&#34;
            alt=&#34;Options&#34;width=&#34;820&#34;height=&#34;114&#34;title=&#34;Options&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Options&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h3 id=&#34;legend&#34;&gt;Legend&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Legend&lt;/strong&gt; setting defines the time series&amp;rsquo;s name. You can use a predefined or custom format.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Auto&lt;/strong&gt; - Displays unique labels. Also displays all overlapping labels if a series has multiple labels.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Verbose&lt;/strong&gt; - Displays all label names.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Custom&lt;/strong&gt; - Uses templating to select which labels will be included. For example, &lt;code&gt;{{hostname}}&lt;/code&gt; is replaced by the label value for the label &lt;code&gt;hostname&lt;/code&gt;. Clear the input and click outside of it to select another mode.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;min-step&#34;&gt;Min step&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Min step&lt;/strong&gt; setting defines the lower bounds on the interval between data points.
For example, set this to &lt;code&gt;1h&lt;/code&gt; to hint that measurements are taken hourly.
This setting supports the &lt;code&gt;$__interval&lt;/code&gt; and &lt;code&gt;$__rate_interval&lt;/code&gt; macros.&lt;/p&gt;
&lt;h3 id=&#34;format&#34;&gt;Format&lt;/h3&gt;
&lt;p&gt;Switch between the following format options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Time series&lt;/strong&gt; - The default time series format. See &lt;a href=&#34;/developers/dataplane/timeseries/&#34;&gt;Time series kind formats&lt;/a&gt; for information on time series data frames and how time and value fields are structured.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Table&lt;/strong&gt; - This works only in a &lt;a href=&#34;/docs/grafana/v10.1/panels-visualizations/visualizations/table/&#34;&gt;Table panel&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Heatmap&lt;/strong&gt; - Displays metrics of the Histogram type on a &lt;a href=&#34;/docs/grafana/v10.1/panels-visualizations/visualizations/heatmap/&#34;&gt;Heatmap panel&lt;/a&gt; by converting cumulative histograms to regular ones and sorting the series by the bucket bound.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;type&#34;&gt;Type&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Type&lt;/strong&gt; setting sets the query type. These include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Both&lt;/strong&gt; - The default option. Returns results for both a &lt;strong&gt;Range&lt;/strong&gt; query and an &lt;strong&gt;Instant&lt;/strong&gt; query.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Range&lt;/strong&gt; - Returns a range vector consisting of a set of time series data containing a range of data points over time for each time series. You can choose lines, bars, points, stacked lines or stacked bars&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Instant&lt;/strong&gt; - Returns one data point per query and only the most recent point in the time range provided. The results can be shown in table format or as raw data. To depict instant query results in the time series panel, first add a field override, next add a property to the override named &lt;code&gt;Transform&lt;/code&gt;, and finally select &lt;code&gt;Constant&lt;/code&gt; from the &lt;strong&gt;Transform&lt;/strong&gt; dropdown.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information, refer to the &lt;a href=&#34;/docs/grafana/v10.1/panels-visualizations/visualizations/time-series/#transform&#34;&gt;Time Series Transform option documentation&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;Grafana modifies the request dates for queries to align them with the dynamically calculated step.
This ensures a consistent display of metrics data, but it can result in a small gap of data at the right edge of a graph.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;exemplars&#34;&gt;Exemplars&lt;/h3&gt;
&lt;p&gt;Toggle &lt;strong&gt;Exemplars&lt;/strong&gt; to run a query that includes exemplars in the graph. Exemplars are unique to Prometheus. For more information see &lt;a href=&#34;/docs/grafana/v10.1/fundamentals/exemplars/&#34;&gt;Introduction to exemplars&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;There is no option to add exemplars with an &lt;strong&gt;Instant&lt;/strong&gt; query type.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;inspector&#34;&gt;Inspector&lt;/h3&gt;
&lt;p&gt;Click &lt;strong&gt;Inspector&lt;/strong&gt; to get detailed statistics regarding your query. Inspector functions as a kind of debugging tool that &amp;ldquo;inspects&amp;rdquo; your query. It provides query statistics under &lt;strong&gt;Stats&lt;/strong&gt;, request response time under &lt;strong&gt;Query&lt;/strong&gt;, data frame details under &lt;strong&gt;{} JSON&lt;/strong&gt;, and the shape of your data under &lt;strong&gt;Data&lt;/strong&gt;.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/insepctor-9-5.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;/static/img/docs/prometheus/insepctor-9-5.png&#34;data-srcset=&#34;/static/img/docs/prometheus/insepctor-9-5.png?w=320 320w, /static/img/docs/prometheus/insepctor-9-5.png?w=550 550w, /static/img/docs/prometheus/insepctor-9-5.png?w=750 750w, /static/img/docs/prometheus/insepctor-9-5.png?w=900 900w, /static/img/docs/prometheus/insepctor-9-5.png?w=1040 1040w, /static/img/docs/prometheus/insepctor-9-5.png?w=1240 1240w, /static/img/docs/prometheus/insepctor-9-5.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Inspector&#34;width=&#34;578&#34;height=&#34;328&#34;title=&#34;Inspector&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/insepctor-9-5.png&#34;
            alt=&#34;Inspector&#34;width=&#34;578&#34;height=&#34;328&#34;title=&#34;Inspector&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Inspector&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h2 id=&#34;builder-mode&#34;&gt;Builder mode&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Builder mode&lt;/strong&gt; helps you build queries using a visual interface. This option is best for users who have limited or no previous experience working with Prometheus and PromQL.&lt;/p&gt;
&lt;p&gt;This video demonstrates how to use the visual Prometheus query builder available in Grafana v9.0:&lt;/p&gt;





  
  
  


&lt;div&gt;
  &lt;iframe src=&#34;https://player.vimeo.com/video/742056367?transparent=0&#34; title=&#34;vimeo video&#34; webkitallowfullscreen=&#34;&#34; mozallowfullscreen=&#34;&#34; allowfullscreen=&#34;&#34;&gt;&lt;/iframe&gt;
  &lt;div &gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/br&gt;
&lt;h3 id=&#34;metrics&#34;&gt;Metrics&lt;/h3&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/metrics-and-labels.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;/static/img/docs/prometheus/metrics-and-labels.png&#34;data-srcset=&#34;/static/img/docs/prometheus/metrics-and-labels.png?w=320 320w, /static/img/docs/prometheus/metrics-and-labels.png?w=550 550w, /static/img/docs/prometheus/metrics-and-labels.png?w=750 750w, /static/img/docs/prometheus/metrics-and-labels.png?w=900 900w, /static/img/docs/prometheus/metrics-and-labels.png?w=1040 1040w, /static/img/docs/prometheus/metrics-and-labels.png?w=1240 1240w, /static/img/docs/prometheus/metrics-and-labels.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Metric and label filters&#34;width=&#34;641&#34;height=&#34;120&#34;title=&#34;Metric and label filters&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/metrics-and-labels.png&#34;
            alt=&#34;Metric and label filters&#34;width=&#34;641&#34;height=&#34;120&#34;title=&#34;Metric and label filters&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Metric and label filters&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;When you are ready to create a query, you can choose the specific metric name from the dropdown list under &lt;strong&gt;Metric&lt;/strong&gt;.
The data source requests the list of available metrics from the Prometheus server based on the selected time rage.
You can also enter text into the selector when the dropdown is open to search and filter the list.&lt;/p&gt;
&lt;h4 id=&#34;metrics-explorer&#34;&gt;Metrics explorer&lt;/h4&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.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;/static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png&#34;data-srcset=&#34;/static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=320 320w, /static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=550 550w, /static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=750 750w, /static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=900 900w, /static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=1040 1040w, /static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=1240 1240w, /static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Metrics explorer&#34;width=&#34;1322&#34;height=&#34;643&#34;title=&#34;Metrics explorer&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/screenshot-grafana-prometheus-metrics-explorer-2.png&#34;
            alt=&#34;Metrics explorer&#34;width=&#34;1322&#34;height=&#34;643&#34;title=&#34;Metrics explorer&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Metrics explorer&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;If you would like to explore your metrics in the query builder further, you can open the &lt;strong&gt;Metrics Explorer&lt;/strong&gt; by clicking the first option in the metric select component of the query builder.&lt;/p&gt;
&lt;p&gt;The metrics explorer is different than the metrics browser. The metrics explorer is only found in the query builder section. The metrics browser is only found in the code editor. The metrics explorer does not have the ability to browse labels yet, but the metrics browser can display all labels on a metric name.&lt;/p&gt;
&lt;p&gt;The metrics explorer displays all metrics in a paginated table list. The list shows the total number of metrics, as well as the name, type and description for each metric. You can enter text into the search input to filter results.
You can also filter by type.&lt;/p&gt;
&lt;p&gt;There are also additional settings for the following items:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Include description in search. Search by name &lt;strong&gt;and&lt;/strong&gt; description&lt;/li&gt;
&lt;li&gt;Include results with no metadata. Many Prometheus metrics have no metadata. This allows users to include metrics with undefined type and description.&lt;/li&gt;
&lt;li&gt;Disable text wrap.&lt;/li&gt;
&lt;li&gt;Enable regex search. This uses the Prometheus API to enable regex search for the metric name.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;label-filters&#34;&gt;Label filters&lt;/h3&gt;
&lt;p&gt;Select desired labels and their values from the dropdown list.
When a metric is selected, the data source requests available labels and their values from the server.
Use the &lt;code&gt;&#43;&lt;/code&gt; button to add a label, and the &lt;code&gt;x&lt;/code&gt; button to remove a label.&lt;/p&gt;
&lt;h3 id=&#34;operations&#34;&gt;Operations&lt;/h3&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/operations.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;/static/img/docs/prometheus/operations.png&#34;data-srcset=&#34;/static/img/docs/prometheus/operations.png?w=320 320w, /static/img/docs/prometheus/operations.png?w=550 550w, /static/img/docs/prometheus/operations.png?w=750 750w, /static/img/docs/prometheus/operations.png?w=900 900w, /static/img/docs/prometheus/operations.png?w=1040 1040w, /static/img/docs/prometheus/operations.png?w=1240 1240w, /static/img/docs/prometheus/operations.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Operations&#34;width=&#34;652&#34;height=&#34;102&#34;title=&#34;Operations&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/operations.png&#34;
            alt=&#34;Operations&#34;width=&#34;652&#34;height=&#34;102&#34;title=&#34;Operations&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Operations&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Select the &lt;strong&gt;&#43; Operations&lt;/strong&gt; button to add operations to your query.&lt;/p&gt;
&lt;p&gt;The query editor groups operations into the following sections:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Aggregations - for additional information see &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Aggregation operators&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Range functions - for additional information see &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/functions/#functions&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Functions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Functions - for additional information see &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/functions/#functions&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Functions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Binary operations - for additional information see &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/operators/#binary-operators&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Binary operators&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Trigonometric - for additional information see &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Trigonometric functions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Time functions - for additional information see &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/functions/#functions&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Functions&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All operations have function parameters under the operation header. Click the &lt;code&gt;operator&lt;/code&gt; to see a full list of supported functions. Some operations allow you to apply specific labels to functions.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/use-function-by-label-9-5.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;/static/img/docs/prometheus/use-function-by-label-9-5.png&#34;data-srcset=&#34;/static/img/docs/prometheus/use-function-by-label-9-5.png?w=320 320w, /static/img/docs/prometheus/use-function-by-label-9-5.png?w=550 550w, /static/img/docs/prometheus/use-function-by-label-9-5.png?w=750 750w, /static/img/docs/prometheus/use-function-by-label-9-5.png?w=900 900w, /static/img/docs/prometheus/use-function-by-label-9-5.png?w=1040 1040w, /static/img/docs/prometheus/use-function-by-label-9-5.png?w=1240 1240w, /static/img/docs/prometheus/use-function-by-label-9-5.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Functions and labels&#34;width=&#34;614&#34;height=&#34;429&#34;title=&#34;Functions and labels&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/use-function-by-label-9-5.png&#34;
            alt=&#34;Functions and labels&#34;width=&#34;614&#34;height=&#34;429&#34;title=&#34;Functions and labels&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Functions and labels&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Some operations make sense only when used in a specific order.
If adding an operation would result in nonsensical query, the query editor adds the operation to the correct place.&lt;/p&gt;
&lt;h4 id=&#34;hints&#34;&gt;Hints&lt;/h4&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/hint-example.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;/static/img/docs/prometheus/hint-example.png&#34;data-srcset=&#34;/static/img/docs/prometheus/hint-example.png?w=320 320w, /static/img/docs/prometheus/hint-example.png?w=550 550w, /static/img/docs/prometheus/hint-example.png?w=750 750w, /static/img/docs/prometheus/hint-example.png?w=900 900w, /static/img/docs/prometheus/hint-example.png?w=1040 1040w, /static/img/docs/prometheus/hint-example.png?w=1240 1240w, /static/img/docs/prometheus/hint-example.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Hint&#34;width=&#34;655&#34;height=&#34;197&#34;title=&#34;Hint&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/hint-example.png&#34;
            alt=&#34;Hint&#34;width=&#34;655&#34;height=&#34;197&#34;title=&#34;Hint&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Hint&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;The query editor can detect which operations are most appropriate for some selected metrics.
If it does, it displays a hint next to the &lt;strong&gt;&#43; Operations&lt;/strong&gt; button.&lt;/p&gt;
&lt;p&gt;To add the operation to your query, click the &lt;strong&gt;Hint&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Once you are satisfied with your query, click &lt;strong&gt;Run query&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;code-mode&#34;&gt;Code mode&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Code mode&lt;/strong&gt; is for the experienced Prometheus user with prior expertise in PromQL, Prometheus&amp;rsquo; query language. The Code mode editor allows you to create queries just as you would in Prometheus. For more information about PromQL see &lt;a href=&#34;http://prometheus.io/docs/querying/basics/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Querying Prometheus&lt;/a&gt;.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/code-mode.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;/static/img/docs/prometheus/code-mode.png&#34;data-srcset=&#34;/static/img/docs/prometheus/code-mode.png?w=320 320w, /static/img/docs/prometheus/code-mode.png?w=550 550w, /static/img/docs/prometheus/code-mode.png?w=750 750w, /static/img/docs/prometheus/code-mode.png?w=900 900w, /static/img/docs/prometheus/code-mode.png?w=1040 1040w, /static/img/docs/prometheus/code-mode.png?w=1240 1240w, /static/img/docs/prometheus/code-mode.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Code mode&#34;width=&#34;1688&#34;height=&#34;171&#34;title=&#34;Code mode&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/code-mode.png&#34;
            alt=&#34;Code mode&#34;width=&#34;1688&#34;height=&#34;171&#34;title=&#34;Code mode&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Code mode&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;The user interface (UI) also lets you select metrics, labels, filters and operations.&lt;/p&gt;
&lt;p&gt;You can write complex queries using the text editor with autocompletion features and syntax highlighting.
It also contains a &lt;a href=&#34;#metrics-browser&#34;&gt;Metrics browser&lt;/a&gt; to further help you write queries.&lt;/p&gt;
&lt;h3 id=&#34;use-autocomplete&#34;&gt;Use autocomplete&lt;/h3&gt;
&lt;p&gt;Code mode&amp;rsquo;s autocomplete feature works automatically while typing. The query editor can autocomplete static functions, aggregations, keywords, and also dynamic items like metrics and labels.
The autocompletion dropdown includes documentation for the suggested items where available.&lt;/p&gt;
&lt;h3 id=&#34;metrics-browser&#34;&gt;Metrics browser&lt;/h3&gt;
&lt;p&gt;The metrics browser locates metrics and selects relevant labels to help you build basic queries.
When you click &lt;strong&gt;Metrics browser&lt;/strong&gt; in &lt;code&gt;Code&lt;/code&gt; mode, it displays all available metrics and labels.
If supported by your Prometheus instance, each metric also displays its &lt;code&gt;HELP&lt;/code&gt; and &lt;code&gt;TYPE&lt;/code&gt; as a tooltip.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--no-shadow&#34;
    style=&#34;max-width: 500px;&#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;/static/img/docs/prometheus/metric-browser.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;/static/img/docs/prometheus/metric-browser.png&#34;data-srcset=&#34;/static/img/docs/prometheus/metric-browser.png?w=320 320w, /static/img/docs/prometheus/metric-browser.png?w=550 550w, /static/img/docs/prometheus/metric-browser.png?w=750 750w, /static/img/docs/prometheus/metric-browser.png?w=900 900w, /static/img/docs/prometheus/metric-browser.png?w=1040 1040w, /static/img/docs/prometheus/metric-browser.png?w=1240 1240w, /static/img/docs/prometheus/metric-browser.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Metrics browser&#34;width=&#34;954&#34;height=&#34;342&#34;title=&#34;Metrics browser&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/prometheus/metric-browser.png&#34;
            alt=&#34;Metrics browser&#34;width=&#34;954&#34;height=&#34;342&#34;title=&#34;Metrics browser&#34;class=&#34;docs-image--no-shadow&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Metrics browser&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;When you select a metric under Step 1, the browser narrows down the available labels to show only the ones applicable to the metric.
You can then select one or more labels shown in Step 2.
Select one or more values in Step 3 for each label to tighten your query scope.
In Step 4, you can select &lt;strong&gt;Use query&lt;/strong&gt; to run the query, &lt;strong&gt;Use as rate query&lt;/strong&gt; to add the rate operation to your query (&lt;code&gt;$__rate_interval&lt;/code&gt;), &lt;strong&gt;Validate selector&lt;/strong&gt; to verify the selector is valid and show the number of series found, or &lt;strong&gt;Clear&lt;/strong&gt; to clear your selections and start over.&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;If you do not remember a metric name, you can also select a few labels to narrow down the list, then find relevant label values.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;All lists in the metrics browser have a search field above them to quickly filter for metrics or labels that match a certain string.
The values section has only one search field, and its filtering applies to all labels to help you find values across labels once selected.&lt;/p&gt;
&lt;p&gt;For example, among your labels &lt;code&gt;app&lt;/code&gt;, &lt;code&gt;job&lt;/code&gt;, &lt;code&gt;job_name&lt;/code&gt; only one might have the value you are looking for.&lt;/p&gt;
&lt;p&gt;Once you are satisfied with your query, click &lt;strong&gt;Run query&lt;/strong&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="prometheus-query-editor">Prometheus query editor&lt;/h1>
&lt;p>Grafana provides a query editor for the Prometheus data source to create queries in PromQL. For more information about PromQL, see &lt;a href="http://prometheus.io/docs/querying/basics/" target="_blank" rel="noopener noreferrer">Querying Prometheus&lt;/a>.&lt;/p></description></item><item><title>Prometheus template variables</title><link>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/template-variables/</link><pubDate>Wed, 23 Aug 2023 20:27:59 +0000</pubDate><guid>https://grafana.com/docs/grafana/v10.1/datasources/prometheus/template-variables/</guid><content><![CDATA[&lt;h1 id=&#34;prometheus-template-variables&#34;&gt;Prometheus template variables&lt;/h1&gt;
&lt;p&gt;Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana refers to such variables as &lt;strong&gt;template&lt;/strong&gt; variables.
Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard.&lt;/p&gt;
&lt;p&gt;For an introduction to templating and template variables, see &lt;a href=&#34;/docs/grafana/v10.1/dashboards/variables/&#34;&gt;Templating&lt;/a&gt; and &lt;a href=&#34;/docs/grafana/v10.1/dashboards/variables/add-template-variables/&#34;&gt;Add and manage variables&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-query-variables&#34;&gt;Use query variables&lt;/h2&gt;
&lt;p&gt;You have the option to use several different variable types, but variables of the type &lt;code&gt;Query&lt;/code&gt; will query Prometheus for a list of metrics, labels, label values, a query result or a series.&lt;/p&gt;
&lt;p&gt;Select a Prometheus data source query type and enter the required inputs:&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;Query Type&lt;/th&gt;
              &lt;th&gt;Input(* required)&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Used API endpoints&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Label names&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;metric&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of all label names matching the specified &lt;code&gt;metric&lt;/code&gt; regex.&lt;/td&gt;
              &lt;td&gt;/api/v1/labels&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Label values&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;label&lt;/code&gt;*, &lt;code&gt;metric&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of label values for the &lt;code&gt;label&lt;/code&gt; in all metrics or the optional metric.&lt;/td&gt;
              &lt;td&gt;/api/v1/label/&lt;code&gt;label&lt;/code&gt;/values or /api/v1/series&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Metrics&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;metric&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of metrics matching the specified &lt;code&gt;metric&lt;/code&gt; regex.&lt;/td&gt;
              &lt;td&gt;/api/v1/label/__name__/values&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Query result&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;query&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of Prometheus query result for the &lt;code&gt;query&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;/api/v1/query&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Series query&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;metric&lt;/code&gt;, &lt;code&gt;label&lt;/code&gt; or both&lt;/td&gt;
              &lt;td&gt;Returns a list of time series associated with the entered data.&lt;/td&gt;
              &lt;td&gt;/api/v1/series&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;For details on &lt;em&gt;metric names&lt;/em&gt;, &lt;em&gt;label names&lt;/em&gt;, and &lt;em&gt;label values&lt;/em&gt;, refer to the &lt;a href=&#34;http://prometheus.io/docs/concepts/data_model/#metric-names-and-labels&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;query-options&#34;&gt;Query options&lt;/h3&gt;
&lt;p&gt;Under the query variable type, you can set the following query options:&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;Option&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;strong&gt;Data source&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Select your data source from the dropdown list.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Select query type&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Options are &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;metric name&lt;/code&gt;. Each query type hits a different Prometheus endpoint.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Regex&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Optional, if you want to extract part of a series name or metric node segment.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Sort&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Default is &lt;code&gt;disabled&lt;/code&gt;. Options include &lt;code&gt;alphabetical&lt;/code&gt;, &lt;code&gt;numerical&lt;/code&gt; and &lt;code&gt;alphabetical case-sensitive&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Refresh&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;When to update the values for the variable. Options are &lt;code&gt;On dashboard load&lt;/code&gt; and &lt;code&gt;On time range change&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;selection-options&#34;&gt;Selection options&lt;/h3&gt;
&lt;p&gt;The following selection options are available:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Multi-value&lt;/strong&gt; - Check this option to enable multiple values to be selected at the same time.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Include All option&lt;/strong&gt; - Check this option to include all variables.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;use-interval-and-range-variables&#34;&gt;Use interval and range variables&lt;/h3&gt;
&lt;p&gt;You can use some global built-in variables in query variables, for example, &lt;code&gt;$__interval&lt;/code&gt;, &lt;code&gt;$__interval_ms&lt;/code&gt;, &lt;code&gt;$__range&lt;/code&gt;, &lt;code&gt;$__range_s&lt;/code&gt; and &lt;code&gt;$__range_ms&lt;/code&gt;.
For details, see &lt;a href=&#34;/docs/grafana/v10.1/dashboards/variables/add-template-variables/#global-variables&#34;&gt;Global built-in variables&lt;/a&gt;.
The &lt;code&gt;label_values&lt;/code&gt; function doesn&amp;rsquo;t support queries, so you can use these variables in conjunction with the &lt;code&gt;query_result&lt;/code&gt; function to filter variable queries.&lt;/p&gt;
&lt;p&gt;Make sure to set the variable&amp;rsquo;s &lt;code&gt;refresh&lt;/code&gt; trigger to be &lt;code&gt;On Time Range Change&lt;/code&gt; to get the correct instances when changing the time range on the dashboard.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Populate a variable with the busiest 5 request instances based on average QPS over the time range shown in the dashboard:&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;Query: query_result(topk(5, sum(rate(http_requests_total[$__range])) by (instance)))
Regex: /&amp;#34;([^&amp;#34;]&amp;#43;)&amp;#34;/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Populate a variable with the instances having a certain state over the time range shown in the dashboard, using &lt;code&gt;$__range_s&lt;/code&gt;:&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;Query: query_result(max_over_time(&amp;lt;metric&amp;gt;[${__range_s}s]) != &amp;lt;state&amp;gt;)
Regex:&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;use-__rate_interval&#34;&gt;Use &lt;code&gt;$__rate_interval&lt;/code&gt;&lt;/h2&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;Available in Grafana v7.2 and higher.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;We recommend using &lt;code&gt;$__rate_interval&lt;/code&gt; in the &lt;code&gt;rate&lt;/code&gt; and &lt;code&gt;increase&lt;/code&gt; functions instead of &lt;code&gt;$__interval&lt;/code&gt; or a fixed interval value.
Because &lt;code&gt;$__rate_interval&lt;/code&gt; is always at least four times the value of the Scrape interval, it avoid problems specific to Prometheus.&lt;/p&gt;
&lt;p&gt;For example, instead of using:&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;rate(http_requests_total[5m])&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;or:&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;rate(http_requests_total[$__interval])&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We recommend that you use:&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;rate(http_requests_total[$__rate_interval])&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The value of &lt;code&gt;$__rate_interval&lt;/code&gt; is defined as
&lt;em&gt;max(&lt;code&gt;$__interval&lt;/code&gt; &#43; &lt;em&gt;Scrape interval&lt;/em&gt;, 4 * &lt;em&gt;Scrape interval&lt;/em&gt;)&lt;/em&gt;,
where &lt;em&gt;Scrape interval&lt;/em&gt; is the &amp;ldquo;Min step&amp;rdquo; setting (also known as &lt;code&gt;query*interval&lt;/code&gt;, a setting per PromQL query) if any is set.
Otherwise, Grafana uses the Prometheus data source&amp;rsquo;s &amp;ldquo;Scrape interval&amp;rdquo; setting.&lt;/p&gt;
&lt;p&gt;The &amp;ldquo;Min interval&amp;rdquo; setting in the panel is modified by the resolution setting, and therefore doesn&amp;rsquo;t have any effect on &lt;em&gt;Scrape interval&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For details, refer to the &lt;a href=&#34;/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/&#34;&gt;Grafana blog&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;choose-a-variable-syntax&#34;&gt;Choose a variable syntax&lt;/h2&gt;
&lt;p&gt;The Prometheus data source supports two variable syntaxes for use in the &lt;strong&gt;Query&lt;/strong&gt; field:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$&amp;lt;varname&amp;gt;&lt;/code&gt;, for example &lt;code&gt;rate(http_requests_total{job=~&amp;quot;$job&amp;quot;}[$_rate_interval])&lt;/code&gt;, which is easier to read and write but does not allow you to use a variable in the middle of a word.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[[varname]]&lt;/code&gt;, for example &lt;code&gt;rate(http_requests_total{job=~&amp;quot;[[job]]&amp;quot;}[$_rate_interval])&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;ve enabled the &lt;em&gt;Multi-value&lt;/em&gt; or &lt;em&gt;Include all value&lt;/em&gt; options, Grafana converts the labels from plain text to a regex-compatible string, which requires you to use &lt;code&gt;=~&lt;/code&gt; instead of &lt;code&gt;=&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-the-ad-hoc-filters-variable-type&#34;&gt;Use the ad hoc filters variable type&lt;/h2&gt;
&lt;p&gt;Prometheus supports the special &lt;a href=&#34;/docs/grafana/v10.1/dashboards/variables/add-template-variables/#add-ad-hoc-filters&#34;&gt;ad hoc filters&lt;/a&gt; variable type, which you can use to specify any number of label/value filters on the fly.
These filters are automatically applied to all your Prometheus queries.&lt;/p&gt;
]]></content><description>&lt;h1 id="prometheus-template-variables">Prometheus template variables&lt;/h1>
&lt;p>Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana refers to such variables as &lt;strong>template&lt;/strong> variables.
Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard.&lt;/p></description></item></channel></rss>