Files
grafana/apps/dashboard/pkg/migration/testdata/dev-dashboards-output/datasource-elasticsearch/elasticsearch_simple.v42.json
T
Ivan Ortega Alba a72e02f88a Fix dashboard migration discrepancies between backend and frontend implementations (use toEqual) (#110268)
**Highlights**

* **Single-version migrations**: add `targetVersion` to migrator & model, separate outputs, enforce exact version.
* **Datasource fixes**: include `apiVersion` in tests, empty-string → `{}`, preserve `{}` refs, drop unwanted defaults.
* **Panel defaults & nesting**: only top-level panels get defaults; preserve empty `transformations` context-aware; filter repeated panels.

* **Migration parity**

  * V16: collapsed rows, grid height parsing (`px`).
  * V17: omit `maxPerRow` when `minSpan=1`.
  * V19–V20: cleanup defaults (`targetBlank`, style).
  * V23–V24: template vars + table panel consistency.
  * V28: full singlestat/stat parity, mappings & color.
  * V30–V36: threshold logic, empty refs, nested targets.
* **Save-model cleanup**: replicate frontend defaults/filtering, drop null IDs, metadata, unused props.
* **Testing**: unified suites, dev dashboards (v42), full unit coverage for major migrations.

Co-authored-by: Ivan Ortega [ivanortegaalba@gmail.com](mailto:ivanortegaalba@gmail.com)
Co-authored-by: Dominik Prokop [dominik.prokop@grafana.com](mailto:dominik.prokop@grafana.com)
2025-09-24 12:20:25 +02:00

1124 lines
26 KiB
JSON

{
"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": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": 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": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "",
"bucketAggs": [
{
"field": "hostname",
"id": "2",
"settings": {
"min_doc_count": "1",
"order": "asc",
"orderBy": "1",
"size": "5"
},
"type": "terms"
},
{
"field": "@timestamp",
"id": "3",
"settings": {
"interval": "auto",
"min_doc_count": "0",
"timeZone": "utc",
"trimEdges": "0"
},
"type": "date_histogram"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"metrics": [
{
"field": "value",
"id": "1",
"type": "max"
}
],
"query": "*",
"refId": "A",
"timeField": "@timestamp"
}
],
"title": "Top 5 servers",
"type": "timeseries"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": 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": 12,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"bucketAggs": [
{
"field": "metric",
"id": "3",
"settings": {
"min_doc_count": 1,
"order": "asc",
"orderBy": "1",
"size": "5"
},
"type": "terms"
},
{
"field": "@timestamp",
"id": "2",
"settings": {
"interval": "auto",
"min_doc_count": 0,
"trimEdges": 0
},
"type": "date_histogram"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"field": "value",
"id": "1",
"type": "avg"
}
],
"query": "metric:cpu",
"refId": "A",
"target": "",
"timeField": "@timestamp"
},
{
"alias": "",
"bucketAggs": [
{
"field": "metric",
"id": "3",
"settings": {
"min_doc_count": "1",
"order": "desc",
"orderBy": "_term",
"size": "10"
},
"type": "terms"
},
{
"field": "@timestamp",
"id": "2",
"settings": {
"interval": "auto"
},
"type": "date_histogram"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"hide": false,
"metrics": [
{
"field": "float",
"id": "1",
"type": "avg"
}
],
"query": "metric:latency",
"refId": "B",
"timeField": "@timestamp"
}
],
"title": "Average metrics",
"type": "timeseries"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": 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": 8
},
"id": 3,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "{{metric}}",
"bucketAggs": [
{
"field": "@timestamp",
"id": "2",
"settings": {
"interval": "5m",
"min_doc_count": 0,
"trimEdges": 0
},
"type": "date_histogram"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"field": "value",
"id": "1",
"meta": {},
"settings": {
"percents": [
25,
50,
75,
95,
99
]
},
"type": "percentiles"
}
],
"query": "metric:cpu",
"refId": "A",
"target": "",
"timeField": "@timestamp"
}
],
"title": "Percentiles \u0026 metric filter",
"type": "timeseries"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": 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": 12,
"y": 8
},
"id": 4,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "{{metric}}",
"bucketAggs": [
{
"field": "@timestamp",
"id": "2",
"settings": {
"interval": "auto",
"min_doc_count": 0,
"trimEdges": 0
},
"type": "date_histogram"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"field": "value",
"id": "1",
"meta": {
"std_deviation_bounds_lower": true,
"std_deviation_bounds_upper": true
},
"settings": {},
"type": "extended_stats"
}
],
"query": "metric:cpu",
"refId": "A",
"target": "",
"timeField": "@timestamp"
}
],
"title": "Standard dev",
"type": "timeseries"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 16
},
"id": 5,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"alias": "",
"bucketAggs": [
{
"field": "hostname",
"id": "2",
"settings": {
"min_doc_count": 1,
"order": "asc",
"orderBy": "_term",
"size": "0"
},
"type": "terms"
},
{
"field": "level",
"id": "5",
"settings": {
"min_doc_count": "1",
"order": "desc",
"orderBy": "_term",
"size": "10"
},
"type": "terms"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"field": "value",
"id": "1",
"meta": {},
"settings": {},
"type": "avg"
},
{
"field": "value",
"id": "3",
"meta": {},
"settings": {},
"type": "max"
},
{
"field": "value",
"id": "4",
"meta": {},
"settings": {},
"type": "sum"
}
],
"query": "",
"refId": "B",
"timeField": "@timestamp"
}
],
"title": "ES metrics",
"type": "table"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 23
},
"id": 10,
"options": {
"controls": {
"mouseWheelZoom": true,
"showAttribution": true,
"showDebug": false,
"showMeasure": false,
"showScale": false,
"showZoom": true
},
"layers": [
{
"config": {
"showLegend": true,
"style": {
"color": {
"fixed": "dark-green"
},
"opacity": 0.4,
"rotation": {
"fixed": 0,
"max": 360,
"min": -360,
"mode": "mod"
},
"size": {
"fixed": 5,
"max": 15,
"min": 2
},
"symbol": {
"fixed": "img/icons/marker/circle.svg",
"mode": "fixed"
},
"textConfig": {
"fontSize": 12,
"offsetX": 0,
"offsetY": 0,
"textAlign": "center",
"textBaseline": "middle"
}
}
},
"location": {
"mode": "auto"
},
"name": "Layer 1",
"tooltip": true,
"type": "markers"
}
],
"tooltip": {
"mode": "details"
},
"view": {
"allLayers": true,
"id": "zero",
"lat": 0,
"lon": 0,
"zoom": 1
}
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"alias": "",
"bucketAggs": [
{
"field": "location",
"id": "2",
"settings": {
"precision": "3"
},
"type": "geohash_grid"
}
],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"metrics": [
{
"id": "1",
"type": "count"
}
],
"query": "",
"refId": "A",
"timeField": "@timestamp"
}
],
"title": "Location with count in Geomap",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {},
"renameByName": {
"location": "geohash"
}
}
}
],
"type": "geomap"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"gridPos": {
"h": 6,
"w": 12,
"x": 0,
"y": 33
},
"id": 6,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"alias": "",
"bucketAggs": [],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"id": "1",
"settings": {
"limit": "500"
},
"type": "logs"
}
],
"query": "",
"refId": "B",
"timeField": "@timestamp"
}
],
"title": "Logs",
"type": "logs"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"gridPos": {
"h": 6,
"w": 12,
"x": 12,
"y": 33
},
"id": 9,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"alias": "",
"bucketAggs": [],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"id": "1",
"settings": {
"limit": "500"
},
"type": "logs"
}
],
"query": "",
"refId": "B",
"timeField": "@timestamp"
}
],
"title": "Logs reordered",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {
"@timestamp": 0,
"_id": 3,
"_index": 4,
"_source": 5,
"_type": 6,
"counter": 7,
"description": 8,
"float": 9,
"highlight": 10,
"hostname": 11,
"label": 12,
"level": 1,
"line": 2,
"location": 13,
"metric": 14,
"shapes": 15,
"sort": 16,
"value": 17
},
"renameByName": {}
}
}
],
"type": "logs"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 39
},
"id": 8,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"alias": "",
"bucketAggs": [],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"id": "1",
"settings": {
"size": "10"
},
"type": "raw_data"
}
],
"query": "",
"refId": "B",
"timeField": "@timestamp"
}
],
"title": "Raw data in table",
"type": "table"
},
{
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 46
},
"id": 7,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"alias": "",
"bucketAggs": [],
"datasource": {
"type": "elasticsearch",
"uid": "gdev-elasticsearch"
},
"dsType": "elasticsearch",
"metrics": [
{
"id": "1",
"settings": {
"size": "500"
},
"type": "raw_document"
}
],
"query": "",
"refId": "B",
"timeField": "@timestamp"
}
],
"title": "Raw document with json transformation in table",
"transformations": [
{
"id": "extractFields",
"options": {
"format": "json",
"replace": true,
"source": "B"
}
}
],
"type": "table"
}
],
"refresh": "",
"schemaVersion": 42,
"tags": [
"gdev",
"elasticsearch",
"datasource-test"
],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Datasource tests - Elasticsearch simple",
"uid": "es_simple",
"weekStart": ""
}