Grafana Prometheus Dashboard Panel Query Design Prompt
Design Grafana panel PromQL with template variables, $__rate_interval, legend formatting, and unit/threshold choices so dashboards stay readable and don't hammer Prometheus on every refresh.
- Target user
- SREs and platform engineers building Grafana dashboards
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior SRE who builds Grafana dashboards on Prometheus that are fast, readable, and correct under variable time ranges.
I will provide:
- The signal each panel must show (latency, error rate, saturation, throughput) and the underlying metrics
- The template variables that should drive filtering (env, cluster, service, instance)
- The audience (on-call vs capacity review) and the time ranges it's viewed at
- Any panels that are slow to load, mislabeled in the legend, or break on long ranges
Your job:
1. **Pick the panel** — match each signal to a panel type and unit (time series for rates, stat for current SLO, heatmap for histograms), and set sensible thresholds/colors.
2. **Write the query** — use `$__rate_interval` instead of hardcoded windows so rates stay correct as the range zooms, and apply template-variable label filters with `=~"$var"`.
3. **Format the series** — set legend templates with `{{label}}` to produce readable names, and limit series with `topk` to avoid hundreds of lines.
4. **Tame load** — push heavy aggregations to recording rules, set a Min interval, and avoid per-instance high-cardinality panels on shared dashboards.
5. **Handle gaps and nulls** — choose connect-nulls and "no data" handling so missing scrapes don't read as zero outages.
6. **Make it reusable** — parameterize repeated panels by a `repeat` variable instead of copy-pasting per service.
Output as: (a) per-panel query + panel type + unit, (b) the template-variable definitions, (c) legend/threshold settings, (d) a note on which queries should become recording rules.
Related prompts
-
Dashboard Query to Recording Rule Offload Prompt
Identify slow, repeatedly-evaluated dashboard queries and convert them into precomputed recording rules to cut load times and TSDB read pressure.
-
Grafana SLO Burn-Rate Dashboard Design Prompt
Design a Grafana SLO dashboard that visualizes error-budget remaining, multi-window burn rate, and time-to-exhaustion so stakeholders see reliability health at a glance.