Stage 6 · Operate
Dashboards with Grafana
Panels and Transformations
Using time series, stat, table, heatmap, logs panels, thresholds, overrides, and transformations.
Panel Types
Each panel type serves a specific visualization purpose. Choosing the right panel type makes data easier to understand. Match the panel to the data shape and the question you are answering.
| Panel Type | Best For | Example Use |
|---|---|---|
| Time series | Trends over time | Request rate, latency, error rate |
| Stat | Single value with status | Active connections, queue depth |
| Gauge | Value against threshold | CPU usage, disk space |
| Table | Multi-dimensional comparison | Top endpoints by latency |
| Heatmap | Distribution over time | Request latency distribution |
| Logs | Log stream display | Application logs from Loki |
Time Series Panel
The time series panel is the most common Grafana panel. It displays metrics as lines, bars, or points over time. It supports multiple queries, legends, and fill modes.
{
"targets": [
{
"expr": "sum by(endpoint) (rate(http_requests_total[5m]))",
"legendFormat": "{{ endpoint }}",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10
}
}
}
}Stat Panel
The stat panel displays a single value prominently. It can show color based on thresholds and is ideal for KPIs, current values, and status indicators. Use it for the top row of a dashboard.
# Current request rate
sum(rate(http_requests_total[5m]))
# Active instances
count(up == 1)
# Error percentage
sum(rate(http_requests_total{status=~"5.."}[5m]))
/ sum(rate(http_requests_total[5m])) * 100Heatmap Panel
The heatmap panel visualizes histogram distributions over time. Each column represents a time bucket, and color intensity shows the count of observations in each value range. Heatmaps reveal distribution shifts that line charts hide.
Heatmaps show the full latency distribution over time. A line chart showing p95 hides whether the distribution is bimodal or has long tails. Heatmaps reveal these patterns visually.
Thresholds and Overrides
Thresholds add color coding based on value ranges. Overrides apply specific settings to individual fields or series. Together they make dashboards scannable at a glance.
{
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": null },
{ "color": "yellow", "value": 50 },
{ "color": "red", "value": 80 }
]
}
}
}
}Transformations
Transformations modify query results before rendering. They can join series, filter rows, rename fields, calculate derived values, and restructure data. Transformations are powerful for creating complex visualizations from multiple queries.
{
"transformations": [
{
"id": "reduce",
"options": {
"reducers": ["mean", "max"],
"fields": "/.*/"
}
},
{
"id": "sortBy",
"options": {
"sort": [{ "field": "Mean", "desc": true }]
}
}
]
}Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.