Files
grafana/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.annotation-conversions.v2beta1.json
T
Dominik Prokop bb787a2637 Schema v2: Move annotation mappings out of legacyOptions (#114721)
* Add mappings property to v2(alpha/beta)1

* Mappings convetions

* OpenAPI spec

* fe annotaations mapping

* Update snapshots

* v2->v1 conversion

* fix tests

---------

Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-12-03 10:19:21 +01:00

350 lines
8.6 KiB
JSON

{
"kind": "Dashboard",
"apiVersion": "dashboard.grafana.app/v2beta1",
"metadata": {
"name": "annotation-conversions-test",
"labels": {
"test": "annotation-conversions"
}
},
"spec": {
"annotations": [
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "grafana",
"version": "v0",
"datasource": {
"name": "-- Grafana --"
},
"spec": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
}
},
"enable": true,
"hide": false,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations \u0026 Alerts",
"builtIn": true,
"legacyOptions": {
"type": "dashboard"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "existing-ref-uid"
},
"spec": {
"expr": "ALERTS{alertstate=\"firing\"}",
"interval": "1m",
"refId": "Anno",
"step": 60
}
},
"enable": true,
"hide": false,
"iconColor": "red",
"name": "Prometheus Annotations",
"builtIn": false,
"legacyOptions": {
"type": "prometheus"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "default-ds-uid"
},
"spec": {
"lines": 10,
"refId": "Anno",
"scenarioId": "annotations"
}
},
"enable": true,
"hide": false,
"iconColor": "blue",
"name": "TestData Annotations",
"builtIn": false,
"legacyOptions": {
"type": "testdata"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "elasticsearch",
"version": "v0",
"datasource": {
"name": "existing-target-uid"
},
"spec": {
"query": "tags:deployment",
"refId": "Anno",
"timeField": "@timestamp"
}
},
"enable": true,
"hide": false,
"iconColor": "yellow",
"name": "Elasticsearch Annotations",
"builtIn": false,
"legacyOptions": {
"tagsField": "tags",
"textField": "message",
"timeEndField": "end_time",
"timeField": "@timestamp",
"type": "elasticsearch"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "loki",
"version": "v0",
"datasource": {
"name": "non-default-test-ds-uid"
},
"spec": {
"format": "table",
"rawSql": "SELECT time, title, text, tags FROM annotations WHERE $__timeFilter(time)",
"refId": "Anno"
}
},
"enable": true,
"hide": false,
"iconColor": "green",
"name": "SQL Annotations",
"builtIn": false,
"legacyOptions": {
"tagsColumn": "tags",
"textColumn": "text",
"timeColumn": "time",
"titleColumn": "title",
"type": "sql"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "",
"version": "v0",
"spec": {
"expr": "static_annotation_query",
"refId": "Anno"
}
},
"enable": true,
"hide": false,
"iconColor": "purple",
"name": "No Datasource Annotation",
"builtIn": false,
"legacyOptions": {
"type": "manual"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "existing-ref-uid"
},
"spec": {
"expr": "disabled_query",
"refId": "Anno"
}
},
"enable": false,
"hide": true,
"iconColor": "gray",
"name": "Hidden Annotation",
"builtIn": false,
"legacyOptions": {
"type": "prometheus"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "influxdb",
"version": "v0",
"datasource": {
"name": "influx-uid"
},
"spec": {
"query": "from(bucket: \"events\") |\u003e range(start: $__timeFrom, stop: $__timeTo) |\u003e filter(fn: (r) =\u003e r._measurement == \"deployments\")",
"refId": "Anno"
}
},
"enable": true,
"hide": false,
"iconColor": "#FF5722",
"name": "Complex Filter Annotation",
"builtIn": false,
"filter": {
"exclude": true,
"ids": [
1,
2,
3
]
},
"mappings": {
"tags": {
"source": "field",
"value": "labels"
},
"text": {
"source": "field",
"value": "description"
},
"time": {
"source": "field",
"value": "timestamp"
},
"title": {
"source": "field",
"value": "service"
}
},
"legacyOptions": {
"type": "influxdb"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "cloudwatch",
"version": "v0",
"datasource": {
"name": "cloudwatch-uid"
},
"spec": {
"dimensions": {
"InstanceId": "i-1234567890abcdef"
},
"metricName": "CPUUtilization",
"namespace": "AWS/EC2",
"refId": "Anno",
"statistic": "Average"
}
},
"enable": true,
"hide": false,
"iconColor": "orange",
"name": "CloudWatch Annotations",
"builtIn": false,
"legacyOptions": {
"showIn": 0,
"type": "cloudwatch"
}
}
},
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "default-ds-uid"
},
"spec": {
"expr": "ALERTS{alertstate=\"firing\"}",
"interval": "1m",
"refId": "Anno",
"step": 60
}
},
"enable": false,
"hide": true,
"iconColor": "transparent",
"name": "Disabled Built-in Annotation",
"builtIn": true,
"legacyOptions": {
"type": "prometheus"
}
}
}
],
"cursorSync": "Off",
"description": "Testing annotation transformations",
"editable": true,
"elements": {},
"layout": {
"kind": "GridLayout",
"spec": {
"items": []
}
},
"links": [],
"liveNow": false,
"preload": false,
"tags": [
"test",
"annotations"
],
"timeSettings": {
"timezone": "browser",
"from": "now-24h",
"to": "now",
"autoRefresh": "",
"autoRefreshIntervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"hideTimepicker": false,
"fiscalYearStartMonth": 0
},
"title": "Annotation Conversions Test Dashboard",
"variables": []
},
"status": {}
}