Grafana Guide: State Timeline, Status History, Logs and Text Panels

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 add five panels to the dashboard Bookshelf (guides). A state timeline shows whether the Bookshelf service is healthy or failing over time, and a status history shows which scrape targets Prometheus reached, both with value mappings that turn the numbers 0 and 1 into words and colours. A logs panel lists the error lines of the service from Loki, a traces panel draws one trace from Tempo, and a text panel with a heading works as the header of the dashboard.

Dashboard Bookshelf (guides) in view mode with five new panels: a text header, a state timeline of the error state, a status history of the scrape targets, a logs panel with error lines and a traces panel with one trace

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 guide Create a dashboard and the first panel first: it creates the folder Guides and the dashboard Bookshelf (guides) that this guide extends. The previous guide, Bar chart, pie, histogram and heatmap, shows the same way of building panels from queries.

  • The data sources Prometheus, Loki and Tempo are provisioned by the lab, so there is nothing to add. The load generator sends traffic to the Bookshelf service in its default mode, which gives the queries something to draw.

  • The guide was checked on Grafana Enterprise 13.3.0 (the free image, no licence key). Editing dashboards needs the Editor or Admin role of the organization; 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 panel editor used here is the one shown in the map of the first dashboard guide; come back to that map when a control is not where a figure shows it. Each panel is built in the panel editor and left with Back; the dashboard is saved once at the end.

Open the dashboard and add a panel

  1. In the left navigation, click Dashboards, open the folder Guides and click Bookshelf (guides).

  2. Click Edit at the top right.

    Dashboard Bookshelf (guides) in view mode with the navigation docked: callout 1 marks the Dashboards item of the navigation and callout 2 marks the Edit button of the toolbar
  3. In the toolbar, click Add.

  4. In the Add pane of the right sidebar, click the Panel tile.

    Dashboard Bookshelf (guides) in edit mode with the Add pane of the right sidebar open: callout 3 marks the Add button of the toolbar and callout 4 marks the Panel tile of the Add pane
  5. In the Panel pane that replaces the Add pane, click Edit visualization.

Show the error state as a state timeline

  1. At the bottom of the panel editor, check that the Queries tab is selected and that Data source shows Prometheus.

  2. In query A, click Code in the Builder / Code switch.

  3. Click inside the query editor first, so that it has the focus, then type the query. It returns 1 while the Bookshelf service answers requests with a 5xx status and 0 otherwise (the editor wraps the long line, as the figure shows):

    (sum(rate(http_server_requests_seconds_count{application="bookshelf",status=~"5.."}[1m])) or vector(0)) > bool 0
  4. Click Run queries.

    Panel editor on the Queries tab: the Prometheus data source is marked by callout 6, the Code option by callout 7, the two-line query that returns 1 while the 5xx rate is above zero and 0 otherwise by callout 8, and Run queries by callout 9
  5. In the right column, click the All visualizations tab, then click State timeline ("State changes and durations").

  6. The right column becomes the options pane, headed State timeline. Open Panel options and type Bookshelf error state in Title.

  7. Open Value mappings and add a mapping for the value 0 with the display text Healthy and the colour green.

  8. Add a second mapping for the value 1 with the display text Failing and the colour red.

    Panel editor with the State timeline options pane: the Title holds Bookshelf error state (callout 11), the Value mappings group (callout 12) lists the mapping of 0 to Healthy in green and the new mapping of 1 to Failing in red (callout 13); the preview draws one row that is Healthy, then Failing, then Healthy again
  9. Click Back in the header of the editor. The 13.3 panel editor has no Apply button; the panel stays on the dashboard, which is saved at the end.

Show the scrape targets as a status history

  1. Repeat steps 3 to 5: click Add, click the Panel tile and click Edit visualization.

  2. In query A, click Code.

  3. Click inside the query editor, then type the metric that Prometheus keeps for every scrape target, 1 when the target answered and 0 when it did not:

    up
  4. Click Run queries.

    Panel editor in Code mode for the second panel: the Code option is marked by callout 16, the query up is typed in the editor (callout 17) and Run queries is marked by callout 18
  5. In the right column, click All visualizations, then Status history ("Periodic status history").

  6. Under Panel options, type Scrape targets (up) in Title.

  7. Open Value mappings and add a mapping for the value 1 with the display text Up and the colour green.

  8. Add a second mapping for the value 0 with the display text Down and the colour red.

    Panel editor with the Status history options pane: the Title holds Scrape targets (up), marked by callout 20, and the Value mappings group lists the mapping of 1 to Up in green, marked by callout 21, and of 0 to Down in red, marked by callout 22; the preview draws one row of green cells for each scrape target
  9. Click Back.

List the error lines in a logs panel

  1. Repeat steps 3 to 5: click Add, click the Panel tile and click Edit visualization.

  2. At the bottom of the editor, open the Data source picker and choose Loki.

  3. If the query editor shows a Builder / Code switch, click Code.

  4. Click inside the query editor, then type the query, which keeps the log lines whose JSON field status is 500 or more:

    {application="bookshelf"} | json | status >= 500
  5. Click Run queries.

    Panel editor for the logs panel: the data source picker shows Loki (callout 25), the Code option is marked by callout 26, the LogQL query for requests with a status of 500 or more is typed in the editor (callout 27) and Run queries is marked by callout 28
  6. In the right column, click All visualizations, then Logs.

  7. Under Panel options, type Bookshelf errors in Title.

  8. Open Logs and switch on Show timestamps.

  9. Switch on Wrap lines.

  10. Set Order to Newest first.

    Panel editor with the Logs options pane: the Title holds Bookshelf errors (callout 30), Show timestamps is on (callout 31), Wrap lines is on (callout 32) and Order is set to Newest first (callout 33); the preview lists log lines with a time, the level ERROR and the request
  11. Click Back. Until the lab has produced errors the panel is empty; the check at the end of this guide provokes some.

Draw one trace in a traces panel

  1. Repeat steps 3 to 5: click Add, click the Panel tile and click Edit visualization.

  2. At the bottom of the editor, open the Data source picker and choose Tempo.

  3. Paste a trace ID into the query field. Copy it from a log line: every line of the Bookshelf service carries a trace_id field, which you can read in the details of a line in the logs panel or in Explore with the data source Loki.

  4. Click Run queries.

    Panel editor for the traces panel: the data source picker shows Tempo (callout 36), the query field holds a trace ID copied from a log line (callout 37) and Run queries is marked by callout 38
  5. In the right column, click All visualizations, then Traces.

  6. Under Panel options, type Trace of one request in Title.

  7. Click Back.

Add a text panel as the dashboard header

  1. Repeat steps 3 to 5: click Add, click the Panel tile and click Edit visualization.

  2. In the right column, under Start without data, click the Text card.

    Panel editor of a new panel before any query: under Start without data the right column offers the cards Text, Alert list and Dashboard list, and the Text card is marked by callout 43
  3. In the options pane, open Text and check that Mode is Markdown.

  4. In Content, type the heading and the sentence:

    # Bookshelf (guides)
    
    Request rates, latency, health, logs and traces of the Bookshelf service.
  5. Under Panel options, leave Title empty and switch on Transparent background, so that the panel looks like a heading and not like a box.

    Panel editor with the Text options pane: Mode is set to Markdown (callout 44), the Content box holds a Markdown heading and a sentence (callout 45) and Transparent background is on (callout 46); the preview shows the rendered heading and the sentence
  6. Click Save in the header of the editor.

  7. In the Save dashboard drawer, click Save.

  8. Click Back to return to the dashboard.

  9. Click Exit edit. If Grafana 13.3.0 shows the dialog Unsaved changes, click Save and click Save again in the drawer, as in the first dashboard guide.

Check the result

Open Dashboards → Guides → Bookshelf (guides). The text panel shows the heading, the state timeline is Healthy for the whole range, the status history shows one row of Up cells for each scrape target, and the traces panel shows the trace you pasted. The logs panel stays empty while the service answers without errors.

Force errors, wait a minute and press Refresh. The state timeline turns to Failing and the logs panel lists lines with a status of 500:

curl -X POST localhost:8090/mode/failing

Restore normal traffic afterwards; the state timeline returns to Healthy about a minute later, when the one-minute rate window has drained. Check the mode of the load generator at any time:

curl -X POST localhost:8090/mode/normal
curl localhost:8090/

Variations

  • Draw the services of the whole lab: remove the label filter from the logs query to list every application, or filter the status history with a job label to keep one target.

  • Show the values inside the state timeline and merge equal values: the options Show values and Merge equal consecutive values of the group State timeline control it.

  • Turn the log lines into a table of fields: switch on Enable columns for displayed fields in the group Logs.

  • Narrow the traces panel to the slow spans with the options of the group Span filters.

  • Use HTML instead of Markdown as the Mode of the text panel when the header needs a link or an image.

What can go wrong

Symptom Cause Fix

The state timeline or the status history shows the numbers 0 and 1 instead of words

The value mappings were not added, or the value typed in a mapping does not match the number of the query.

Open Value mappings and check that the values are exactly 0 and 1.

The status history says Too many points to visualize properly

The time range holds more points than the panel can draw.

Pick a shorter range, for example the last hour, with the time picker.

The logs panel is empty

The service has answered without errors so far, or the lab started less than a minute ago.

Send curl -X POST localhost:8090/mode/failing, wait a minute and press Refresh.

The traces panel is empty or reports an error

The trace ID was cut when copying, or the trace is older than the time range or no longer stored.

Copy a fresh trace_id from a recent log line and run the query again.

The text panel shows the characters of the heading instead of a heading

Mode is HTML or Code.

Set Mode to Markdown in the group Text.

Exit edit keeps showing Unsaved changes

Grafana 13.3.0 raises the dialog even after a save.

Click Save, and Save again in the drawer; the dialog does not return once edit mode has closed.

Clean up

Keep the panels: later guides on this dashboard build on them. To remove them, open the dashboard, click Edit, open the menu of each panel and delete it, then save the dashboard.

Where to go next