Grafana Guide: Explore Metrics

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-11 against Grafana 13.3.x.

What you build

You explore the request metrics of the Bookshelf service without building a dashboard. You build a query with the Prometheus query builder until it draws the request rate per HTTP status, read the same query as PromQL, write a second query that computes the 95th percentile of the request duration, compare queries in a split view, run an old query again from the history, look at a query with the inspector, and end in the Metrics Drilldown app, which lists every metric as a small chart.

Explore with Prometheus after the guide: the query sum by status of the rate of http_server_requests_seconds_count for the application bookshelf is drawn in the Graph as one line for the status 200 and one for 404

Before you start

  • Start the Grafana profile of the hands-on lab and wait about a minute:

    cd lab
    docker compose --profile grafana up -d
  • Open http://localhost:3000, sign in as admin with the password admin, and click Skip when Grafana 13.3 asks you to update the default password.

  • Do the previous guide, Add a data source, or at least use the provisioned data source Prometheus, which is the default and which this guide queries. Your own guide-prometheus works the same way.

  • The load generator sends traffic to the Bookshelf service in its default mode, which gives the queries something to draw. Check the mode with curl localhost:8090/.

  • The guide was checked on Grafana Enterprise 13.3.0 (the free image, no licence key). Explore needs the Viewer role or higher; admin has it.

  • The figures are drawings of the Grafana 13.3 user interface, not screenshots, so small details can differ from your screen. A highlighted box with a number marks the control of the step with the same number.

Steps

The screen map shows the areas of Explore that the steps use. Come back to it when a control is not where the figures show it. The figures draw the toolbar and one query; the page also has a left outline with Queries and Graph that the figures leave out.

Map of Grafana 13.3 Explore with eight numbered regions: the Outline button, the data source picker, Split and Add, the time controls with Run query, the query row, the Builder fields, the Add query row and the Graph with its display switch

Open Explore

  1. In the left navigation, click Explore.

  2. Check that the data source picker at the top shows Prometheus. If it shows another data source, open the picker and choose Prometheus.

    Explore page of Grafana 13.3 with the docked navigation: callout 1 marks the Explore item of the navigation and callout 2 marks the data source picker, which shows Prometheus; below it the empty query A offers the Builder and Code switch

Build the query with the builder

  1. In query A, make sure Builder is selected. Click the Metric select, which shows Select metric, and type http_server_requests_seconds.

  2. Choose http_server_requests_seconds_count from the list. It counts the requests the Bookshelf service has answered.

    Explore Builder with the Metric select open and http_server_requests_seconds typed into it, marked by callout 3; the list offers the _bucket, _count and _sum metrics and callout 4 marks http_server_requests_seconds_count
  3. Under Label filters, click Add.

  4. In the label select, choose application. The operator stays at =.

  5. In the value select, choose bookshelf. Without this filter the query also counts the requests of other applications.

    Explore Builder with the metric http_server_requests_seconds_count chosen: under Label filters the Add button is marked by callout 5, the label select shows application (callout 6) and the value select shows bookshelf (callout 7) with the operator equals between them
  6. Click Operations, open the category Range functions and choose Rate. A card Rate appears next to the button.

  7. Click Operations again, open the category Aggregations and choose Sum by. A card Sum by appears after the first one.

    Explore Builder with the Operations menu open, listing the categories Aggregations, Range functions, Functions, Binary operations, Trigonometric and Time Functions: callout 8 marks Range functions, which holds Rate, and callout 9 marks Aggregations, which holds Sum by
  8. In the card Rate, check that Range is 1m; if not, type 1m. The rate is then computed over the last minute.

  9. In the card Sum by, choose status in Label. The sum then keeps one series per HTTP status.

  10. Click the blue Run query button of the toolbar. The line under the cards shows the PromQL that the builder generated:

    sum by (status) (rate(http_server_requests_seconds_count{application="bookshelf"}[1m]))
    Explore Builder with the operations Rate, with its Range field set to 1m (callout 10), and Sum by, with its Label field set to status (callout 11); the generated PromQL line is shown under them and the Run query button of the toolbar is marked by callout 12
  11. Look at the Graph: a green line for the status 200 and a yellow line for 404. In the display switch above the chart, click Bars to see the same data as bars, then click Lines again.

    Explore after Run query: the Graph draws one line for the status 200 and one for 404, and its display switch Lines, Bars, Points, Stacked lines and Stacked bars is marked by callout 13

Read the query as code and explain it

  1. In the Builder / Code switch of query A, click Code. The editor shows the PromQL of the builder.

  2. Turn on the Explain switch of the query. Grafana describes the query step by step; read it, and turn the switch off again if you like.

  3. Click Add query at the bottom of the queries. A second query, B, appears.

    Explore query A in Code mode with the builder query shown as PromQL in the editor: the Code option of the Builder and Code switch is marked by callout 14, the Explain switch by callout 15 and the Add query button by callout 16
  4. In the empty query B, click Kick start your query. The button is offered only while a query is empty.

  5. Choose one of the starting queries it lists to see how it fills the query. The list is not part of the guide: its entries depend on the data source.

    Explore with query A collapsed to one line and a new empty query B below it: the button Kick start your query of query B is marked by callout 17

Write a percentile with histogram_quantile

  1. In query B, click Code in the Builder / Code switch.

  2. Click inside the editor so that it has the focus, select all with Ctrl+A (Cmd+A on macOS) to replace what the starting query put there, and type the query:

    histogram_quantile(0.95, sum by (le) (rate(http_server_requests_seconds_bucket{application="bookshelf"}[1m])))
  3. Click Run queries. The graph now draws the 95th percentile of the request duration, in seconds, as a series next to the request rates.

    Explore query B in Code mode: the Code option of its switch is marked by callout 19, the editor holds the histogram_quantile query over the http_server_requests_seconds_bucket metric (callout 20) and the Run queries button is marked by callout 21

Compare queries in a split view

  1. Click Split in the toolbar.

  2. A second Explore pane opens next to the first. Use it to try a variation, for example another time range or another query, while the first pane keeps its result.

  3. Close the second pane with the close control at its top right.

    Explore with the Split button of the toolbar marked by callout 22 and, to the right of the first pane, a second Explore pane drawn as a dashed outline and marked by callout 23

Reuse and inspect queries

  1. Under the queries, click Query history. A drawer opens at the bottom with the tabs Query history, Starred and Settings, and one entry for each query you ran, newest first.

  2. Click the star of an entry to keep it under the tab Starred.

  3. Click Run query on an entry to run it again.

  4. Click Query inspector to see the request and the response of the query.

    Explore with the Query history drawer open at the bottom: the Query history button is marked by callout 25, the star of the history entry by callout 26 and its Run query button by callout 27, and the Query inspector button is marked by callout 28

Send the query to a dashboard

  1. Click Add in the toolbar.

  2. Click Add to dashboard. The other entry of the menu, Add correlation, links data sources and is not used here.

    Explore toolbar with the Add menu open: callout 29 marks the Add button and callout 30 marks the entry Add to dashboard, which sits above Add correlation
  3. In the dialog that opens, choose where the panel goes and confirm it, or close the dialog if you only wanted to see it. Choose a new dashboard rather than Bookshelf (guides) when you want to leave the dashboard of the dashboard guides as it is. The dialog was not checked in the lab, so follow its own labels.

Browse the metrics with Drilldown

  1. In the left navigation, open Drilldown and click Metrics. The page is titled All metrics and shows one small chart for every metric.

  2. In the box Quick search metrics, type http_server. The list narrows to the request metrics of the Bookshelf service.

  3. Click Select on the card of http_server_requests_seconds_count. The app opens a view of that metric; it was not checked in detail, so explore it with its own controls.

    Drilldown Metrics page of Grafana 13.3 with the Drilldown group of the navigation open: callout 32 marks Metrics, callout 33 marks the Quick search metrics box holding http_server, and callout 34 marks the Select button of the metric card http_server_requests_seconds_count among three cards

Check the result

Go back to Explore. Query A must draw a green line for 200 and a yellow line for 404, and query B must draw the percentile series. In Query history, both queries must appear.

To see the query react, force errors, run query A again with Run query and wait about a minute:

curl -X POST localhost:8090/mode/failing

A third line appears for the status 500. To see the percentile grow, send the slow mode instead:

curl -X POST localhost:8090/mode/slow

Restore normal traffic afterwards:

curl -X POST localhost:8090/mode/normal

Variations

  • In the Options line below the builder, change Type from Range to Instant to get the latest value per series, and read it in the table that an instant query adds under the graph.

  • Switch the data source picker to guide-prometheus from the previous guide and run the same queries; the result is the same, because both point at the same Prometheus.

  • Replace the label status in Sum by with uri to see the request rate per route instead of per status.

What can go wrong

Symptom Cause Fix

The graph says No data

The time range ends before the data starts, the lab started less than a minute ago, or the load generator is stopped.

Wait a minute and click Run query. Check the mode with curl localhost:8090/ and send curl -X POST localhost:8090/mode/normal if it is not normal.

The editor shows a red error under the query

The text was typed before the editor had the focus, or the old query was not selected before typing, so the query is mangled.

Click in the editor, select all with Ctrl+A (Cmd+A on macOS), and type the query again.

The Metric select lists no http_server_requests_seconds_count

The metric lookup found no Bookshelf data, because the service is not running or Prometheus has not scraped it yet.

Run docker compose --profile grafana ps in the lab folder, wait a minute and open the select again.

Kick start your query is missing

The button is shown only while a query is empty.

Click Add query and use the button on the new query.

The percentile query draws nothing

The histogram buckets have no samples in the last minute, because no traffic is flowing.

Send curl -X POST localhost:8090/mode/normal and run the query again after a minute.

Clean up

The guide creates no saved resources. The query history stays in your browser and the second pane of the split view is closed in step 24. If you added a panel to a dashboard in step 31, remove it from that dashboard or delete the dashboard.

Where to go next