Schema: convert dashboards from v1beta1 to v2beta1 (#109037)
- Implement full conversion pipeline from v1beta1 → v2beta1 - Ensure frontend–backend parity for all dashboard serialization paths - Add automatic data loss detection for conversions (panels, queries, annotations, links, variables) - Extract atomic conversion functions for v0 → v1beta1 → v2alpha1 → v2beta1 - Introduce conversion metrics and detailed logging for loss tracking - Normalize datasource resolution, defaults, and annotation processing - Improve panel layout serialization and y-coordinate normalization - Fix inconsistencies in nested panels and collapsed row behavior - Refine variable handling: - Filter refId from variable query specs - Default variable refresh to 'never' (matches frontend) - Fix constant and interval variable handling for missing queries - Unify schema defaults (enable, hide, iconColor, editable, liveNow) - Fix pluginId usage (UID vs type) and datasource references - Fix metrics.go bug swallowing errors (return nil → return err) - Add tests for version-specific conversion error handling - Add data loss detection tests using source/target version comparison - Clean up lint issues, legacy code, and redundant files - Update OpenAPI snapshots and migrated dashboards - Improve backend migrator to reuse datasource provider and match frontend logic Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com> Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com> Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
+217
@@ -0,0 +1,217 @@
|
||||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "annotation-conversions-test",
|
||||
"labels": {
|
||||
"test": "annotation-conversions"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"title": "Annotation Conversions Test Dashboard",
|
||||
"description": "Testing annotation transformations",
|
||||
"tags": ["test", "annotations"],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"target": {
|
||||
"limit": 100,
|
||||
"matchAny": false,
|
||||
"tags": [],
|
||||
"type": "dashboard"
|
||||
},
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"name": "Prometheus Annotations",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "red",
|
||||
"target": {
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"refId": "Anno",
|
||||
"interval": "1m",
|
||||
"step": 60
|
||||
},
|
||||
"builtIn": 0,
|
||||
"type": "prometheus"
|
||||
},
|
||||
{
|
||||
"name": "TestData Annotations",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "default-ds-uid"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "blue",
|
||||
"target": {
|
||||
"lines": 10,
|
||||
"refId": "Anno",
|
||||
"scenarioId": "annotations"
|
||||
},
|
||||
"builtIn": false,
|
||||
"type": "testdata"
|
||||
},
|
||||
{
|
||||
"name": "Elasticsearch Annotations",
|
||||
"datasource": {
|
||||
"type": "elasticsearch",
|
||||
"uid": "existing-target-uid"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "yellow",
|
||||
"target": {
|
||||
"query": "tags:deployment",
|
||||
"timeField": "@timestamp",
|
||||
"refId": "Anno"
|
||||
},
|
||||
"textField": "message",
|
||||
"tagsField": "tags",
|
||||
"timeField": "@timestamp",
|
||||
"timeEndField": "end_time",
|
||||
"builtIn": 0,
|
||||
"type": "elasticsearch"
|
||||
},
|
||||
{
|
||||
"name": "SQL Annotations",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "non-default-test-ds-uid"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "green",
|
||||
"target": {
|
||||
"format": "table",
|
||||
"rawSql": "SELECT time, title, text, tags FROM annotations WHERE $__timeFilter(time)",
|
||||
"refId": "Anno"
|
||||
},
|
||||
"textColumn": "text",
|
||||
"titleColumn": "title",
|
||||
"tagsColumn": "tags",
|
||||
"timeColumn": "time",
|
||||
"builtIn": 0,
|
||||
"type": "sql"
|
||||
},
|
||||
{
|
||||
"name": "No Datasource Annotation",
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "purple",
|
||||
"target": {
|
||||
"expr": "static_annotation_query",
|
||||
"refId": "Anno"
|
||||
},
|
||||
"builtIn": 0,
|
||||
"type": "manual"
|
||||
},
|
||||
{
|
||||
"name": "Hidden Annotation",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"enable": false,
|
||||
"hide": true,
|
||||
"iconColor": "gray",
|
||||
"target": {
|
||||
"expr": "disabled_query",
|
||||
"refId": "Anno"
|
||||
},
|
||||
"builtIn": 0,
|
||||
"type": "prometheus"
|
||||
},
|
||||
{
|
||||
"name": "Complex Filter Annotation",
|
||||
"datasource": {
|
||||
"type": "influxdb",
|
||||
"uid": "influx-uid"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "#FF5722",
|
||||
"target": {
|
||||
"query": "from(bucket: \"events\") |> range(start: $__timeFrom, stop: $__timeTo) |> filter(fn: (r) => r._measurement == \"deployments\")",
|
||||
"refId": "Anno"
|
||||
},
|
||||
"filter": {
|
||||
"ids": [1, 2, 3],
|
||||
"exclude": true
|
||||
},
|
||||
"mappings": {
|
||||
"title": "service",
|
||||
"text": "description",
|
||||
"time": "timestamp",
|
||||
"tags": "labels"
|
||||
},
|
||||
"builtIn": 0,
|
||||
"type": "influxdb"
|
||||
},
|
||||
{
|
||||
"name": "CloudWatch Annotations",
|
||||
"datasource": {
|
||||
"type": "cloudwatch",
|
||||
"uid": "cloudwatch-uid"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "orange",
|
||||
"target": {
|
||||
"namespace": "AWS/EC2",
|
||||
"metricName": "CPUUtilization",
|
||||
"dimensions": {
|
||||
"InstanceId": "i-1234567890abcdef"
|
||||
},
|
||||
"statistic": "Average",
|
||||
"refId": "Anno"
|
||||
},
|
||||
"showIn": 0,
|
||||
"builtIn": 0,
|
||||
"type": "cloudwatch"
|
||||
},
|
||||
{
|
||||
"name": "Disabled Built-in Annotation",
|
||||
"builtIn": true,
|
||||
"enable": false,
|
||||
"hide": true,
|
||||
"iconColor": "transparent",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "default-ds-uid"
|
||||
},
|
||||
"target": {
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"refId": "Anno",
|
||||
"interval": "1m",
|
||||
"step": 60
|
||||
},
|
||||
"type": "prometheus"
|
||||
}
|
||||
]
|
||||
},
|
||||
"panels": [],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"time": {
|
||||
"from": "now-24h",
|
||||
"to": "now"
|
||||
},
|
||||
"links": []
|
||||
}
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "dashboard-properties-test",
|
||||
"labels": {
|
||||
"test": "dashboard-properties"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"title": "Dashboard Properties Test",
|
||||
"description": "Testing dashboard-level property transformations including time settings, cursor sync, and links",
|
||||
"tags": ["test", "properties", "metadata"],
|
||||
"editable": true,
|
||||
"preload": true,
|
||||
"liveNow": true,
|
||||
"graphTooltip": 2,
|
||||
"fiscalYearStartMonth": 4,
|
||||
"timezone": "America/New_York",
|
||||
"weekStart": "sunday",
|
||||
"refresh": "30s",
|
||||
"time": {
|
||||
"from": "now-12h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"collapse": false,
|
||||
"enable": true,
|
||||
"notice": false,
|
||||
"now": true,
|
||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
|
||||
"status": "Stable",
|
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
|
||||
"type": "timepicker",
|
||||
"hidden": false,
|
||||
"nowDelay": "1m"
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"asDropdown": false,
|
||||
"icon": "external link",
|
||||
"includeVars": true,
|
||||
"keepTime": true,
|
||||
"tags": ["monitoring", "alerts"],
|
||||
"targetBlank": true,
|
||||
"title": "External Monitoring System",
|
||||
"tooltip": "View in external system",
|
||||
"type": "link",
|
||||
"url": "https://monitoring.example.com/dashboard?from=${__from}&to=${__to}"
|
||||
},
|
||||
{
|
||||
"asDropdown": true,
|
||||
"icon": "dashboard",
|
||||
"includeVars": false,
|
||||
"keepTime": false,
|
||||
"tags": ["grafana", "internal"],
|
||||
"targetBlank": false,
|
||||
"title": "Related Dashboards",
|
||||
"tooltip": "Navigate to related dashboards",
|
||||
"type": "dashboards",
|
||||
"url": ""
|
||||
},
|
||||
{
|
||||
"asDropdown": false,
|
||||
"icon": "info",
|
||||
"includeVars": false,
|
||||
"keepTime": false,
|
||||
"tags": [],
|
||||
"targetBlank": true,
|
||||
"title": "Documentation",
|
||||
"tooltip": "View documentation",
|
||||
"type": "link",
|
||||
"url": "https://docs.example.com/dashboard-guide"
|
||||
},
|
||||
{
|
||||
"asDropdown": false,
|
||||
"icon": "tag",
|
||||
"includeVars": true,
|
||||
"keepTime": true,
|
||||
"tags": ["alerts"],
|
||||
"targetBlank": false,
|
||||
"title": "Tag-based Link",
|
||||
"tooltip": "Filtered by tags",
|
||||
"type": "tag",
|
||||
"url": "/dashboards/tag/alerts"
|
||||
}
|
||||
],
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Simple Panel",
|
||||
"type": "stat",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"name": "simple_var",
|
||||
"type": "custom",
|
||||
"query": "value1,value2,value3",
|
||||
"current": {
|
||||
"text": "value1",
|
||||
"value": "value1"
|
||||
},
|
||||
"hide": 0,
|
||||
"skipUrlSync": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"name": "Simple Annotation",
|
||||
"enable": true,
|
||||
"hide": false,
|
||||
"iconColor": "blue",
|
||||
"target": {
|
||||
"refId": "Anno"
|
||||
},
|
||||
"builtIn": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"style": "dark",
|
||||
"version": 42,
|
||||
"schemaVersion": 39,
|
||||
"gnetId": 12345,
|
||||
"iteration": 1640995200000,
|
||||
"snapshot": {
|
||||
"originalUrl": "http://localhost:3000/d/test",
|
||||
"timestamp": "2023-01-01T00:00:00Z"
|
||||
},
|
||||
"meta": {
|
||||
"canEdit": true,
|
||||
"canSave": true,
|
||||
"canStar": true,
|
||||
"canAdmin": false,
|
||||
"slug": "dashboard-properties-test",
|
||||
"url": "/d/test/dashboard-properties-test",
|
||||
"expires": "2024-01-01T00:00:00Z",
|
||||
"created": "2023-01-01T00:00:00Z",
|
||||
"updated": "2023-06-01T00:00:00Z",
|
||||
"updatedBy": "admin",
|
||||
"createdBy": "admin",
|
||||
"version": 42,
|
||||
"hasAcl": false,
|
||||
"isFolder": false,
|
||||
"folderId": 0,
|
||||
"folderTitle": "General",
|
||||
"folderUrl": "",
|
||||
"provisioned": false,
|
||||
"provisionedExternalId": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
+340
@@ -0,0 +1,340 @@
|
||||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "panel-conversions-test",
|
||||
"labels": {
|
||||
"test": "panel-conversions"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"title": "Panel Conversions Test Dashboard",
|
||||
"description": "Testing panel to elements conversion",
|
||||
"tags": ["test", "panels"],
|
||||
"editable": true,
|
||||
"preload": false,
|
||||
"panels": [
|
||||
{
|
||||
"cacheTimeout": "60s",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"lineWidth": 1
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green"
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"interval": "1m",
|
||||
"links": [
|
||||
{
|
||||
"targetBlank": true,
|
||||
"title": "External Link",
|
||||
"url": "https://example.com"
|
||||
}
|
||||
],
|
||||
"maxDataPoints": 300,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
}
|
||||
},
|
||||
"pluginVersion": "10.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"expr": "up",
|
||||
"hide": false,
|
||||
"interval": "30s",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"expr": "cpu_usage",
|
||||
"hide": true,
|
||||
"interval": "1m",
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"title": "Regular Timeseries Panel",
|
||||
"transformations": [
|
||||
{
|
||||
"id": "reduce",
|
||||
"options": {
|
||||
"reducers": ["mean"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"transparent": true,
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"gridPos": {
|
||||
"h": 4,
|
||||
"w": 6,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
},
|
||||
"id": 2,
|
||||
"libraryPanel": {
|
||||
"name": "Shared Stats Panel",
|
||||
"uid": "library-panel-uid-123"
|
||||
},
|
||||
"title": "Library Panel Reference"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "edprtf91hz01se"
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
},
|
||||
"id": 3,
|
||||
"panels": [],
|
||||
"repeat": "server",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "edprtf91hz01se"
|
||||
},
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Row Panel",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"autoMigrateFrom": "graph",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "default-ds-uid"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 8,
|
||||
"x": 0,
|
||||
"y": 9
|
||||
},
|
||||
"id": 4,
|
||||
"maxPerRow": 4,
|
||||
"repeat": "region",
|
||||
"repeatDirection": "h",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "default-ds-uid"
|
||||
},
|
||||
"refId": "A",
|
||||
"scenarioId": "random_walk"
|
||||
}
|
||||
],
|
||||
"title": "Panel in Row",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "elasticsearch",
|
||||
"uid": "existing-target-uid"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "continuous-GrYlRd"
|
||||
},
|
||||
"custom": {
|
||||
"orientation": "horizontal"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 16,
|
||||
"x": 8,
|
||||
"y": 9
|
||||
},
|
||||
"hideTimeOverride": true,
|
||||
"id": 7,
|
||||
"links": [
|
||||
{
|
||||
"title": "Drill Down",
|
||||
"url": "/d/detailed-view"
|
||||
}
|
||||
],
|
||||
"maxDataPoints": 1000,
|
||||
"options": {
|
||||
"barWidth": 0.97,
|
||||
"groupWidth": 0.7,
|
||||
"orientation": "horizontal"
|
||||
},
|
||||
"pluginVersion": "9.5.0",
|
||||
"queryCachingTTL": 300,
|
||||
"targets": [
|
||||
{
|
||||
"bucketAggs": [
|
||||
{
|
||||
"field": "@timestamp",
|
||||
"id": "2",
|
||||
"type": "date_histogram"
|
||||
}
|
||||
],
|
||||
"datasource": {
|
||||
"type": "elasticsearch",
|
||||
"uid": "existing-target-uid"
|
||||
},
|
||||
"query": "*",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"timeFrom": "1h",
|
||||
"timeShift": "1h",
|
||||
"title": "Complex Panel with All Features",
|
||||
"transformations": [
|
||||
{
|
||||
"id": "groupBy",
|
||||
"options": {
|
||||
"fields": {
|
||||
"status": {
|
||||
"aggregations": ["count"],
|
||||
"operation": "groupby"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "sortBy",
|
||||
"options": {
|
||||
"sort": [
|
||||
{
|
||||
"desc": true,
|
||||
"field": "count"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "barchart"
|
||||
},
|
||||
{
|
||||
"collapsed": true,
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "edprtf91hz01se"
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 15
|
||||
},
|
||||
"id": 5,
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "non-default-test-ds-uid"
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 16
|
||||
},
|
||||
"id": 6,
|
||||
"options": {
|
||||
"showHeader": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "non-default-test-ds-uid"
|
||||
},
|
||||
"format": "table",
|
||||
"rawSql": "SELECT * FROM metrics",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Hidden Panel in Collapsed Row",
|
||||
"type": "table"
|
||||
}
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Collapsed Row",
|
||||
"type": "row"
|
||||
}
|
||||
],
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"annotations": {
|
||||
"list": []
|
||||
},
|
||||
"links": []
|
||||
}
|
||||
}
|
||||
+331
@@ -0,0 +1,331 @@
|
||||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "variable-conversions-test",
|
||||
"labels": {
|
||||
"test": "variable-conversions"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"title": "Variable Conversions Test Dashboard",
|
||||
"description": "Testing all variable types and transformations",
|
||||
"tags": ["test", "variables"],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"name": "datasource_var",
|
||||
"type": "datasource",
|
||||
"label": "Data Source",
|
||||
"description": "Select a data source",
|
||||
"query": "prometheus",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "Prometheus",
|
||||
"value": "prometheus-uid"
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "Prometheus",
|
||||
"value": "prometheus-uid"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "InfluxDB",
|
||||
"value": "influx-uid"
|
||||
}
|
||||
],
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"refresh": 1
|
||||
},
|
||||
{
|
||||
"name": "query_var",
|
||||
"type": "query",
|
||||
"label": "Instance",
|
||||
"description": "Available instances",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"definition": "label_values(up, instance)",
|
||||
"query": "label_values(up, instance)",
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": ["All", "localhost:9090"],
|
||||
"value": ["$__all", "localhost:9090"]
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
},
|
||||
{
|
||||
"selected": true,
|
||||
"text": "localhost:9090",
|
||||
"value": "localhost:9090"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "localhost:9091",
|
||||
"value": "localhost:9091"
|
||||
}
|
||||
],
|
||||
"hide": 1,
|
||||
"includeAll": true,
|
||||
"allValue": ".*",
|
||||
"multi": true,
|
||||
"regex": "/.*9090.*/",
|
||||
"skipUrlSync": false,
|
||||
"refresh": 2,
|
||||
"sort": 1,
|
||||
"tagValuesQuery": "",
|
||||
"tagsQuery": "",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"name": "custom_var",
|
||||
"type": "custom",
|
||||
"label": "Environment",
|
||||
"description": "Deployment environment",
|
||||
"query": "prod,staging,dev",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "prod",
|
||||
"value": "prod"
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "prod",
|
||||
"value": "prod"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "staging",
|
||||
"value": "staging"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "dev",
|
||||
"value": "dev"
|
||||
}
|
||||
],
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"allValue": null,
|
||||
"multi": false,
|
||||
"skipUrlSync": false
|
||||
},
|
||||
{
|
||||
"name": "adhoc_var",
|
||||
"type": "adhoc",
|
||||
"label": "Filters",
|
||||
"description": "Add filters",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"key": "job",
|
||||
"operator": "=",
|
||||
"value": "prometheus"
|
||||
}
|
||||
],
|
||||
"baseFilters": [
|
||||
{
|
||||
"key": "environment",
|
||||
"operator": "=",
|
||||
"value": "production"
|
||||
}
|
||||
],
|
||||
"hide": 0,
|
||||
"skipUrlSync": false,
|
||||
"defaultKeys": [
|
||||
{
|
||||
"text": "job",
|
||||
"value": "job"
|
||||
},
|
||||
{
|
||||
"text": "instance",
|
||||
"value": "instance"
|
||||
}
|
||||
],
|
||||
"allowCustomValue": true
|
||||
},
|
||||
{
|
||||
"name": "constant_var",
|
||||
"type": "constant",
|
||||
"label": "App Name",
|
||||
"description": "Application name constant",
|
||||
"query": "my-application",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "my-application",
|
||||
"value": "my-application"
|
||||
},
|
||||
"hide": 2,
|
||||
"skipUrlSync": true
|
||||
},
|
||||
{
|
||||
"name": "interval_var",
|
||||
"type": "interval",
|
||||
"label": "Interval",
|
||||
"description": "Time interval for queries",
|
||||
"query": "1m,5m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "5m",
|
||||
"value": "5m"
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
"selected": false,
|
||||
"text": "1m",
|
||||
"value": "1m"
|
||||
},
|
||||
{
|
||||
"selected": true,
|
||||
"text": "5m",
|
||||
"value": "5m"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "10m",
|
||||
"value": "10m"
|
||||
}
|
||||
],
|
||||
"hide": 0,
|
||||
"auto": true,
|
||||
"auto_count": 30,
|
||||
"auto_min": "10s",
|
||||
"skipUrlSync": false,
|
||||
"refresh": 2
|
||||
},
|
||||
{
|
||||
"name": "textbox_var",
|
||||
"type": "textbox",
|
||||
"label": "Search Term",
|
||||
"description": "Enter search term",
|
||||
"query": "default_search",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "error",
|
||||
"value": "error"
|
||||
},
|
||||
"hide": 0,
|
||||
"skipUrlSync": false
|
||||
},
|
||||
{
|
||||
"name": "groupby_var",
|
||||
"type": "groupby",
|
||||
"label": "Group By",
|
||||
"description": "Group results by field",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"query": "",
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": ["job", "instance"],
|
||||
"value": ["job", "instance"]
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "job",
|
||||
"value": "job"
|
||||
},
|
||||
{
|
||||
"selected": true,
|
||||
"text": "instance",
|
||||
"value": "instance"
|
||||
},
|
||||
{
|
||||
"selected": false,
|
||||
"text": "region",
|
||||
"value": "region"
|
||||
}
|
||||
],
|
||||
"hide": 0,
|
||||
"multi": true,
|
||||
"skipUrlSync": false
|
||||
},
|
||||
{
|
||||
"name": "legacy_string_var",
|
||||
"type": "query",
|
||||
"label": "Legacy Variable",
|
||||
"description": "Variable with legacy string value",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "existing-ref-uid"
|
||||
},
|
||||
"query": "up",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "legacy_value",
|
||||
"value": "legacy_string_content"
|
||||
},
|
||||
"hide": 0,
|
||||
"refresh": 1,
|
||||
"skipUrlSync": false
|
||||
},
|
||||
{
|
||||
"name": "complex_query_var",
|
||||
"type": "query",
|
||||
"label": "Complex Query Variable",
|
||||
"description": "Variable with complex query and all features",
|
||||
"datasource": {
|
||||
"type": "elasticsearch",
|
||||
"uid": "existing-target-uid"
|
||||
},
|
||||
"definition": "terms field:@host size:100",
|
||||
"query": {
|
||||
"query": "*",
|
||||
"size": 100,
|
||||
"bucketAggs": [
|
||||
{
|
||||
"field": "@host",
|
||||
"id": "2",
|
||||
"type": "terms"
|
||||
}
|
||||
]
|
||||
},
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": ["All", "host1", "host2"],
|
||||
"value": ["$__all", "host1", "host2"]
|
||||
},
|
||||
"options": [],
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"allValue": "*",
|
||||
"multi": true,
|
||||
"regex": "/host[0-9]+/",
|
||||
"skipUrlSync": false,
|
||||
"refresh": 1,
|
||||
"sort": 2,
|
||||
"tagValuesQuery": "",
|
||||
"tagsQuery": "",
|
||||
"useTags": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"panels": [],
|
||||
"time": {
|
||||
"from": "now-6h",
|
||||
"to": "now"
|
||||
},
|
||||
"annotations": {
|
||||
"list": []
|
||||
},
|
||||
"links": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user