Grafana Value Mappings and Thresholds Prompt
Configure Grafana value mappings, thresholds, and color schemes so panels turn raw numbers into clear, consistent status signals.
- Target user
- Dashboard authors improving readability and status signaling
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior observability engineer who makes Grafana panels readable with value mappings, thresholds, and color schemes so a glance conveys status. I will provide: - The metric and its raw values (numbers, enum codes, states) - The panel type (stat, gauge, table, timeseries, state timeline) - The status semantics (what is good/warn/bad) Your job: 1. **Value mappings**: map raw values to labels/colors — `value` maps (exact), `range` maps (numeric bands), `regex` maps (pattern), and `special` maps (null/NaN/empty). Turn `0/1/2` into `Down/Degraded/Up`. 2. **Thresholds**: define `thresholds.steps` in `fieldConfig.defaults` with `absolute` or `percentage` mode; each step sets a color from its `value` upward. 3. **Color mode**: choose thresholds-based coloring, `Color scheme` (continuous green-yellow-red), or by series; set `fieldConfig.defaults.color.mode`. 4. **Units + decimals**: set `unit` (e.g. `percent`, `bytes`, `reqps`, `ms`) and `decimals` so mapped values render correctly. 5. **Panel binding**: for stat/gauge, use `Value` or `Background` color mode; for tables, apply color to cell background/text via cell display mode; for state timeline, mappings drive the state colors. 6. **Consistency**: reuse the same threshold palette (green/orange/red) org-wide; centralize via library panels where possible. 7. **Overrides**: apply field overrides so one series (e.g. `latency_p99`) gets stricter thresholds than others. 8. **Accessibility**: don't rely on color alone; keep the mapped text label so colorblind users still read status. Mark DESTRUCTIVE: none — these are display-only settings. Flag misleading thresholds that could hide a real problem (e.g. red band set above an already-critical value). --- Metric + raw values: [DESCRIBE] Panel type: [DESCRIBE] Status semantics: [DESCRIBE]
Why this prompt works
Value mappings, thresholds, and color are where a dashboard becomes glanceable — or misleading. Grafana offers four mapping types and two threshold modes, and mixing them up (percentage vs absolute, or an unmapped state) produces panels that look fine while hiding failure. This prompt pins the mapping type, threshold mode, and units, and insists on text labels for accessibility.
How to use it
- List every possible raw value so no state goes unmapped.
- State the good/warn/bad semantics so thresholds match reality.
- Confirm the unit so thresholds fire at the right magnitude.
- Standardize the palette across the dashboard set.
Useful commands
# Inspect a panel's fieldConfig (mappings + thresholds)
curl -s -H "Authorization: Bearer $TOKEN" \
http://localhost:3000/api/dashboards/uid/svc-health \
| jq '.dashboard.panels[] | {title, mappings: .fieldConfig.defaults.mappings, thresholds: .fieldConfig.defaults.thresholds}'
Example config
Stat panel with value mappings and absolute thresholds:
{
"type": "stat",
"title": "Service State",
"fieldConfig": {
"defaults": {
"unit": "short",
"color": { "mode": "thresholds" },
"mappings": [
{ "type": "value", "options": {
"0": { "text": "Down", "color": "red", "index": 0 },
"1": { "text": "Degraded", "color": "orange", "index": 1 },
"2": { "text": "Up", "color": "green", "index": 2 } } },
{ "type": "special", "options": {
"match": "null", "result": { "text": "No Data", "color": "purple", "index": 3 } } }
],
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "red", "value": null },
{ "color": "orange", "value": 1 },
{ "color": "green", "value": 2 }
]
}
}
},
"options": { "colorMode": "background", "textMode": "value_and_name" }
}
Common findings this catches
- Green while failing → thresholds too loose.
- Inverted colors →
percentagevsabsolutemismatch. - Uncolored cells → an actual state left unmapped.
- Wrong trigger point → unit mismatch (ms vs s, bytes vs bits).
- Hidden gaps → null mapped to a benign label.
- Inaccessible → color used without a text label.
When to escalate
- Org-wide status palette and semantics — observability/design lead.
- Thresholds that should be derived from SLOs — service owner.
- Accessibility standards for dashboards — design system owner.
Related prompts
-
Grafana Library Panels Reuse Prompt
Design reusable Grafana library panels shared across many dashboards so one edit propagates everywhere without copy-paste drift.
-
Grafana State Timeline and Status History Prompt
Design Grafana State timeline and Status history panels to visualize discrete states like up/down, deploy phases, and health over time.
-
Grafana Table Panel Transformations Prompt
Shape Grafana table panels with transformations — join, organize, group-by, and calculations — to turn raw query frames into readable tables.