-
What Grafana version and what operating system are you using?
Grafana v13 -
What are you trying to achieve?
Dashboards schema v1 used to have constant type ininputsto substitute the variables in dashboards during the import process. When I attempt to import such dashboard in Grafana v13, constant typeinputsare being ignored. -
How are you trying to achieve it?
Use the following dashboard v1 JSON model and attempt to import in Grafana v13.x:
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
},
{
"name": "VAR_METRIC_NAME",
"type": "constant",
"label": "Choose a node exporter metric (eg: go_goroutines)",
"value": "",
"description": "Node exporter metric"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "12.1.1"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"disableTextWrap": false,
"editorMode": "builder",
"expr": "${VAR_METRIC_NAME}",
"fullMetaSearch": false,
"includeNullMetadata": true,
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Test panel",
"type": "timeseries"
}
],
"schemaVersion": 41,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "Test dashboard",
"uid": "d7969a18-70fb-407a-9346-b83f3d28f649",
"version": 3,
"weekStart": ""
}
During the import, put go_goroutines as the value for Choose a node exporter metric which should use it as query for Prometheus. However, you can check from panel query, the value is not being substituted.
-
What did you expect to happen?
Constant typeinputsare substituted in dashboards v2 as it was the case in dashboards v1. -
Can you copy/paste the configuration(s) that you are having problems with?
Dashboard JSON model has been already posted above. -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No
Finally, I could not find documentation on how to use the “constant” type inputs in dashboard v2 schema. Would be very helpful if someone has can point me to documentation or give me hints on how to have a similar feature in dashboard v2.
Cheers

