A correctly labelled number with a clear colour beats a raw float that everyone has to interpret.
Panel options on the right of the editor fall into two kinds.
Panel options (title, description, links) and visualization-specific settings such as line width, stacking or the stat's colour mode.
Field options, which apply to the data values:
- Unit: seconds, bytes (IEC or SI), percent (0-100) or percent (0.0-1.0), requests per second and many more. Grafana then scales values automatically: 0.25 s shows as 250 ms, 1536 bytes as 1.50 KiB.
- Min / Max and Decimals.
- Thresholds: base colour plus steps, such as green, yellow above 0.01, red above 0.05. Gauges and stats colour themselves; time series can show threshold lines or areas.
- Value mappings: turn values into text, like
1into "UP" and0into "DOWN", or ranges into labels. - Data links: clickable URLs built from values and labels, for example to a logs query or another dashboard.
Overrides change field options for specific series only: by name, regex, query or field type. Typical uses are a different unit for one series, a dashed line for "last week", or a fixed colour for errors.
Set units in Grafana rather than multiplying in PromQL, so values stay correct and readable at every scale.
Example
{
"type": "stat",
"title": "Error ratio",
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"decimals": 2,
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null},
{"color": "orange", "value": 0.01},
{"color": "red", "value": 0.05}
]
},
"mappings": [{"type": "value", "options": {"NaN": {"text": "no traffic"}}}]
},
"overrides": []
}
}Remember
- Set the unit and let Grafana scale values
- Thresholds colour values; mappings turn values into text
- Overrides change options for selected series only
Watch out for
- Choosing percent (0-100) for a ratio between 0 and 1, so 5% shows as 0.05%.