Table panel

Grafana · Essentials · 8 min

Lists of instances, pods, endpoints or customers are tables, and a table needs its data in a different shape than a graph does.

A Table shows data frames as rows and columns. The first thing to get right is the shape of the data. A Prometheus range query gives one frame per series with a time column, which the table shows as separate frames with a selector; what you usually want is one row per series, so set the query Type to instant and Format to Table. Each label becomes a column, plus Time and Value. For several queries, the Merge transformation combines them into one table, and Organize fields renames and hides columns.

Useful options:

  • Column filter adds a filter control per column; pagination and a footer with calculations (Total, Mean, Count) help long tables.
  • Column width, minimum width and cell height; align left, center or right.
  • Cell options, set per column with overrides: coloured text or coloured background driven by thresholds, a gauge inside the cell, sparkline (needs the Time series to table transformation), JSON view for nested objects, image, or an Actions/data link cell.
  • Value mappings turn 0/1 into "down"/"up" with colours, which reads far better than numbers.

Sorting is by clicking a header, or permanently with the Sort by transformation. Hide the Time column of instant queries; it only holds the evaluation time.

Tables render everything the query returned, so keep result sets small with topk() or SQL LIMIT; thousands of rows make the browser crawl and nobody reads them anyway.

Example

{
  "type": "table",
  "title": "Targets",
  "targets": [{"refId": "A", "instant": true, "format": "table",
               "expr": "up"}],
  "transformations": [
    {"id": "organize", "options": {
      "excludeByName": {"Time": true, "__name__": true},
      "renameByName": {"Value": "status"}}}
  ],
  "fieldConfig": {
    "defaults": {},
    "overrides": [{
      "matcher": {"id": "byName", "options": "status"},
      "properties": [
        {"id": "custom.cellOptions", "value": {"type": "color-background"}},
        {"id": "mappings", "value": [{"type": "value", "options": {
          "0": {"text": "DOWN", "color": "red"},
          "1": {"text": "UP", "color": "green"}}}]}
      ]}]
  },
  "options": {"showHeader": true, "footer": {"show": true, "reducer": ["count"]}}
}

Remember

  • Instant query + Table format gives one row per series
  • Cell options (coloured background, gauge, sparkline) are set per column with overrides
  • Keep tables short with topk() or LIMIT

Watch out for

  • Using a range query in a table and getting a frame picker with hundreds of timestamps per series.

Check yourself

  1. A Prometheus table shows a drop-down of frames instead of one row per instance. What fixes it?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: grafana.com/docs/grafana/latest/panels-visualizations/visualizations/table/