Dashboard Migrations: V2 - legacy services.filter and graphite panel type (#112282)

* migrate to v2

* Fix tests

* graphite panels should be auto-migrated

* lint

* Provisioning: Fix dashboard export to preserve original API version

* Add error handling for the edge case where conversion fails but no
storedVersion is available.
This commit is contained in:
Haris Rozajac
2025-10-15 10:34:12 -06:00
committed by GitHub
parent 5b7e6ef2e1
commit d9067b27eb
13 changed files with 734 additions and 78 deletions
@@ -0,0 +1,89 @@
{
"schemaVersion": 1,
"title": "V2 Comprehensive Migration Test Dashboard",
"services": {
"filter": {
"time": {
"from": "now-6h",
"to": "now"
},
"list": [
{
"name": "server",
"type": "query",
"datasource": "prometheus",
"query": "label_values(server)"
},
{
"name": "env",
"type": "custom",
"options": [
{"text": "Production", "value": "prod"},
{"text": "Staging", "value": "stage"}
]
}
]
}
},
"panels": [
{
"id": 1,
"type": "graphite",
"title": "CPU Usage",
"legend": true,
"grid": {
"min": 0,
"max": 100
},
"y_format": "percent",
"y2_format": "short",
"targets": [
{
"refId": "A",
"target": "cpu.usage"
}
]
},
{
"id": 2,
"type": "graph",
"title": "Memory Usage",
"legend": false,
"grid": {
"min": 0
},
"y_format": "bytes",
"targets": [
{
"refId": "A",
"target": "memory.usage"
}
]
},
{
"id": 3,
"type": "table",
"title": "Server Stats",
"legend": true,
"grid": {
"min": 0,
"max": 100
},
"y_format": "short",
"y2_format": "bytes"
},
{
"id": 4,
"type": "graphite",
"title": "Disk I/O",
"legend": true,
"y2_format": "Bps",
"targets": [
{
"refId": "A",
"target": "disk.io"
}
]
}
]
}
@@ -0,0 +1,168 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations \u0026 Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [],
"panels": [
{
"autoMigrateFrom": "graphite",
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"grid": {
"max": 100,
"min": 0
},
"id": 1,
"legend": true,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A",
"target": "cpu.usage"
}
],
"title": "CPU Usage",
"type": "timeseries",
"y2_format": "short",
"y_format": "percent"
},
{
"autoMigrateFrom": "graph",
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"grid": {
"min": 0
},
"id": 2,
"legend": false,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A",
"target": "memory.usage"
}
],
"title": "Memory Usage",
"type": "timeseries",
"y_format": "bytes"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"grid": {
"max": 100,
"min": 0
},
"id": 3,
"legend": true,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Server Stats",
"type": "table",
"y2_format": "bytes",
"y_format": "short"
},
{
"autoMigrateFrom": "graphite",
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"id": 4,
"legend": true,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A",
"target": "disk.io"
}
],
"title": "Disk I/O",
"type": "timeseries",
"y2_format": "Bps"
}
],
"refresh": "",
"schemaVersion": 42,
"tags": [],
"templating": {
"list": [
{
"datasource": "prometheus",
"name": "server",
"options": [],
"query": "label_values(server)",
"refresh": 1,
"type": "query"
},
{
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "stage"
}
],
"type": "custom"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "V2 Comprehensive Migration Test Dashboard",
"weekStart": ""
}
@@ -0,0 +1,121 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations \u0026 Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [],
"panels": [
{
"autoMigrateFrom": "graphite",
"grid": {
"max": 100,
"min": 0
},
"id": 1,
"legend": true,
"targets": [
{
"refId": "A",
"target": "cpu.usage"
}
],
"title": "CPU Usage",
"type": "timeseries",
"y2_format": "short",
"y_format": "percent"
},
{
"autoMigrateFrom": "graph",
"grid": {
"min": 0
},
"id": 2,
"legend": false,
"targets": [
{
"refId": "A",
"target": "memory.usage"
}
],
"title": "Memory Usage",
"type": "timeseries",
"y_format": "bytes"
},
{
"grid": {
"max": 100,
"min": 0
},
"id": 3,
"legend": true,
"title": "Server Stats",
"type": "table",
"y2_format": "bytes",
"y_format": "short"
},
{
"autoMigrateFrom": "graphite",
"id": 4,
"legend": true,
"targets": [
{
"refId": "A",
"target": "disk.io"
}
],
"title": "Disk I/O",
"type": "timeseries",
"y2_format": "Bps"
}
],
"schemaVersion": 2,
"tags": [],
"templating": {
"list": [
{
"datasource": "prometheus",
"name": "server",
"options": [],
"query": "label_values(server)",
"type": "query"
},
{
"name": "env",
"options": [
{
"text": "Production",
"value": "prod"
},
{
"text": "Staging",
"value": "stage"
}
],
"type": "custom"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "V2 Comprehensive Migration Test Dashboard",
"weekStart": ""
}