Grafana Data Links and Drilldowns Prompt
Wire Grafana data links and drilldowns so panels jump to related dashboards, Explore, or external tools carrying filter context.
- Target user
- Dashboard authors building navigable triage flows
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior observability engineer who builds Grafana data links and drilldowns so a click on a series or cell carries context to the right dashboard, Explore query, or external runbook.
I will provide:
- The source panel and what a user wants to reach next
- The variables/labels available in the data
- The target (another dashboard, Explore, external URL)
Your job:
1. **Choose link type**: panel-level data link (applies to whole panel), field-override data link (per field/series), or a cell link on tables.
2. **Use built-in variables**: interpolate `${__value.raw}`, `${__field.name}`, `${__series.name}`, `${__data.fields[...]}`, and dashboard vars like `${namespace}` into the URL.
3. **Preserve time range**: append `${__url_time_range}` so the target opens on the same window; add `${__all_variables}` to carry every template variable.
4. **Link to another dashboard**: build `/d/<uid>/<slug>?var-namespace=${namespace}&${__url_time_range}`.
5. **Link to Explore**: construct a `/explore?left=` payload with the datasource and a query templated from the clicked value for ad-hoc drilldown.
6. **Field overrides**: use "Add field override" > "Data links" to attach links only to specific series (e.g. only the `pod` field opens the pod dashboard).
7. **External tools**: link to runbooks, logs, or trace UIs, URL-encoding interpolated values; open in a new tab where appropriate.
8. **Test interpolation**: verify variables resolve (no literal `${...}` in the final URL) across table, time series, and stat panels.
Mark DESTRUCTIVE: none normally — links are read-only navigation. Flag only links that trigger state-changing external actions (e.g. a link that hits a write API).
---
Source panel: [DESCRIBE]
Available variables/labels: [DESCRIBE]
Target: [DESCRIBE]
Why this prompt works
Grafana’s data-link variable system (${__value.raw}, ${__field.name}, ${__url_time_range}, ${__all_variables}) is powerful but under-documented, and the common failure is a link that drops the time range or leaves a literal ${...} in the URL. This prompt picks the right link scope, carries time and variable context, and forces interpolation testing so drilldowns actually land where the responder needs.
How to use it
- Describe the click-to-destination flow you want.
- List the fields/labels present so links reference real data.
- Always carry the time range unless you deliberately reset it.
- Test every panel type the link appears on.
Useful commands
# Fetch a dashboard to inspect existing data links
curl -s -H "Authorization: Bearer $TOKEN" \
http://localhost:3000/api/dashboards/uid/svc-overview | jq '.dashboard.panels[].fieldConfig.defaults.links'
# Resolve a dashboard slug/uid for building links
curl -s -H "Authorization: Bearer $TOKEN" \
"http://localhost:3000/api/search?query=pod%20detail" | jq '.[] | {uid,url}'
Example config
Panel field config with a data link into another dashboard and one into Explore:
{
"type": "table",
"title": "Pods by error rate",
"fieldConfig": {
"defaults": { "links": [] },
"overrides": [
{
"matcher": { "id": "byName", "options": "pod" },
"properties": [
{
"id": "links",
"value": [
{
"title": "Open pod dashboard",
"url": "/d/pod-detail/pod-detail?var-pod=${__value.raw}&var-namespace=${namespace}&${__url_time_range}",
"targetBlank": false
},
{
"title": "Logs in Explore",
"url": "/explore?left=%7B%22datasource%22:%22loki-prod%22,%22queries%22:%5B%7B%22expr%22:%22%7Bpod%3D%5C%22${__value.raw}%5C%22%7D%22%7D%5D,%22range%22:%7B%22from%22:%22now-1h%22,%22to%22:%22now%22%7D%7D",
"targetBlank": true
}
]
}
]
}
]
}
}
Common findings this catches
- Literal
${...}in URLs → interpolation not resolving on this panel type. - Lost time range →
${__url_time_range}omitted. - Blank target filters → variable absent on the destination dashboard.
- Wrong context → override attached to the wrong field.
- Broken links → hardcoded UID after target recreated.
- Leaked internals →
${__all_variables}sent to an external tool.
When to escalate
- Standardizing a triage navigation graph across dashboards — observability lead.
- Deep-links into external ticketing/write systems — owning team + security.
- Explore payload templating that must survive schema changes — platform team.
Related prompts
-
Grafana Explore Split View Workflow Prompt
Use Grafana Explore split view to correlate metrics, logs, and traces ad hoc during an incident without building a dashboard.
-
Grafana Node Graph Service Map Prompt
Build a Grafana Node graph panel that renders service dependency maps from tracing or metrics data with health-coded edges.
-
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.