Transformations: Selectively apply transformation to queries (#61735)

This commit is contained in:
Ryan McKinley
2023-01-31 09:06:06 -08:00
committed by GitHub
parent e7bfc4e749
commit bba80b6c7a
19 changed files with 417 additions and 51 deletions

View File

@@ -299,7 +299,10 @@
"revision": 1,
"schemaVersion": 37,
"style": "dark",
"tags": [],
"tags": [
"gdev",
"transform"
],
"templating": {
"list": []
},
@@ -309,7 +312,7 @@
},
"timepicker": {},
"timezone": "",
"title": "Test extractFields JSON",
"title": "Transforms - Test extractFields JSON",
"uid": "pD4vPYhVz",
"version": 3,
"weekStart": ""

View File

@@ -0,0 +1,171 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 1394,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"uid": "PD8C576611E62080A",
"type": "testdata"
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
},
"color": {
"mode": "thresholds"
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"id": 2,
"targets": [
{
"scenarioId": "csv_content",
"refId": "A",
"datasource": {
"uid": "PD8C576611E62080A",
"type": "testdata"
},
"csvContent": "AAA\n1\n2\n3\n4"
},
{
"scenarioId": "csv_content",
"refId": "B",
"datasource": {
"uid": "PD8C576611E62080A",
"type": "testdata"
},
"csvContent": "BBB\n1\n2\n3\n4\n",
"hide": false
}
],
"title": "Transformer query filters",
"type": "table",
"transformations": [
{
"id": "reduce",
"options": {
"reducers": [
"min"
],
"mode": "reduceFields",
"includeTimeField": false
},
"filter": {
"id": "byRefId",
"options": "A"
}
},
{
"id": "reduce",
"options": {
"reducers": [
"max"
],
"mode": "reduceFields",
"includeTimeField": false
},
"filter": {
"id": "byRefId",
"options": "B"
}
},
{
"id": "concatenate",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {},
"renameByName": {
"AAA": "Min from Query A",
"BBB": "Max from Query B"
}
}
}
],
"options": {
"showHeader": true,
"footer": {
"show": false,
"reducer": [
"sum"
],
"countRows": false,
"fields": ""
},
"frameIndex": 0
},
"pluginVersion": "9.4.0-pre"
}
],
"schemaVersion": 37,
"style": "dark",
"tags": [
"gdev",
"transform"
],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Transforms - Filters",
"uid": "fGWBVW4k"
}

View File

@@ -624,7 +624,7 @@
},
"timepicker": {},
"timezone": "",
"title": "Join by field",
"title": "Transforms - Join by field",
"uid": "gw0K4rmVz",
"version": 6,
"weekStart": ""

View File

@@ -347,7 +347,7 @@
},
"timepicker": {},
"timezone": "",
"title": "Join by labels",
"title": "Transforms - Join by labels",
"uid": "FVl-9CR4z",
"version": 10,
"weekStart": ""

View File

@@ -521,7 +521,10 @@
],
"schemaVersion": 37,
"style": "dark",
"tags": ["devenv"],
"tags": [
"gdev",
"transform"
],
"templating": {
"list": []
},
@@ -531,6 +534,6 @@
},
"timepicker": {},
"timezone": "",
"title": "Reuse dashboard queries",
"title": "Transforms - Reuse dashboard queries",
"uid": "fYGWTVW4k"
}

View File

@@ -184,6 +184,13 @@ local dashboard = grafana.dashboard;
id: 0,
}
},
dashboard.new('filter', import '../dev-dashboards/transforms/filter.json') +
resource.addMetadata('folder', 'dev-dashboards') +
{
spec+: {
id: 0,
}
},
dashboard.new('gauge-multi-series', import '../dev-dashboards/panel-gauge/gauge-multi-series.json') +
resource.addMetadata('folder', 'dev-dashboards') +
{