Grafana: Transformations and Overrides
A transformation is a step that reshapes a query result inside Grafana, after the query runs. An override is a rule that changes how one field looks, without touching the others.
Table query: requests by route
This query gives one series per route for the table panel.
sum by (route) (rate(http_requests_total[5m]))Reduce: one number per route
Reduce with the Last calculation keeps only the latest value.
{"id": "reduce", "options": {"reducers": ["last"]}}Override: errors in red
This override colours only the 500-status series red.
{"matcher": {"id": "byName", "options": "500"},
"properties": [{"id": "color", "value": {"mode": "fixed", "fixedColor": "red"}}]}Example
sum by (route) (rate(http_requests_total[5m]))Key points
- A transformation changes the shape of the data, like turning time series into one table row per route.
- The Organize fields transformation renames, hides, and reorders columns in a table.
- The Reduce transformation turns many points into one number per series, like the latest value.
- An override targets one field by name, so only that column gets the new unit or colour.
- Use a transformation when the query is right but the table is not.
- Use an override when one series needs different units from the rest of the panel.
In this example, the table query runs against the live ShopSentry stack and returns one series per route. The Reduce transformation then turns each series into a single latest value, so the table shows one row per route. The override colours the error row red.
Note
A transformation never changes the stored metrics. It only changes what the panel shows.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
When should you use a transformation instead of rewriting the query?