# What happened:
I want to configure both of:
- Threshold1
- Max
via theā¦ "Config from query results" transform from a **Prometheus datasource** (in a gauge panel).
All the examples of using "Config from query results" [described by Torkel on Github](https://github.com/grafana/grafana/issues/922#issuecomment-1058424892) and [illustrated on play.grafana.org](https://play.grafana.org/d/Fc6gwV4nz/transforms-config-from-query?orgId=1) use CSV data (the TestDataDB datasource), which allows for multiple 'value' columns. For example [this panel](https://play.grafana.org/d/Fc6gwV4nz/transforms-config-from-query?orgId=1&editPanel=5&tab=query), with columns for both `MyUnit` for Unit and `MyColor` for Color:
![image](https://user-images.githubusercontent.com/2903904/211780592-9607ea98-d9e3-416d-9489-63bbf04d8a0d.png)
![image](https://user-images.githubusercontent.com/2903904/211780807-02799365-21e1-435a-9b09-22239fab69b6.png)
But unfortunately Prometheus queries only ever return a **single value column**. So I can only configure a single property via "Config from query results" as a result.
It's possible to transform data to get more than one value column, using transforms such as "Add field from calculation". But the "Config from query results" transform can't be used downstream of this and pointed at the transformed data immediately upstream. The "Config from query results" transform can only be pointed at raw queries themselves, and not transformed ones š.
In addition it seems to be impossible to use two "Config from query results" transforms, one after another.
# What you expected to happen:
## Either this:
Mainly I expected that I would be able to use "Config from query results" twice over, to configure two separate fields, as follows:
| Key | Value |
|--|--|
| Panel | gauge @ 9.4.0-47373pre |
| Grafana | 9.4.0-47373pre (a9e39a108c) // Enterprise |
<details><summary>Panel debug snapshot dashboard</summary>
```json
{
"panels": [
{
"id": 2,
"gridPos": {
"h": 13,
"w": 15,
"x": 0,
"y": 0
},
"type": "gauge",
"title": "Reproduced with embedded data",
"transformations": [
{
"id": "configFromData",
"options": {
"configRefId": "Threshold1: Included DPM per series",
"mappings": [
{
"fieldName": "Time",
"handlerKey": "__ignore"
},
{
"fieldName": "Value #Threshold1: Included DPM per series",
"handlerKey": "threshold1"
}
],
"applyTo": {
"id": "byType",
"options": "number"
}
}
},
{
"id": "configFromData",
"options": {}
}
],
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"pluginVersion": "9.4.0-47373pre",
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
},
"color": {
"mode": "thresholds"
},
"max": 7,
"min": 0
},
"overrides": []
},
"options": {
"reduceOptions": {
"values": true,
"calcs": [
"lastNotNull"
],
"fields": "",
"limit": 1
},
"orientation": "auto",
"showThresholdLabels": true,
"showThresholdMarkers": true
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"queryType": "snapshot",
"snapshot": [
{
"schema": {
"refId": "Average DPM per series",
"meta": {
"type": "timeseries-multi",
"custom": {
"resultType": "vector"
},
"executedQueryString": "Expr: sort_desc(\n sum by(cluster, id, name) (\n 60 * grafanacloud_instance_samples_per_second\n / grafanacloud_instance_active_series\n\n * on(id) group_left(name) grafanacloud_instance_info\n )\n)\nStep: 30s",
"preferredVisualisationType": "rawPrometheus"
},
"fields": [
{
"name": "Time",
"type": "time",
"config": {}
},
{
"name": "cluster",
"config": {
"filterable": true
},
"type": "string"
},
{
"name": "id",
"config": {
"filterable": true
},
"type": "string"
},
{
"name": "name",
"config": {
"filterable": true
},
"type": "string"
},
{
"name": "Value #Average DPM per series",
"type": "number",
"config": {}
}
]
},
"data": {
"values": [
[
1673433285836,
1673433285836,
1673433285836,
1673433285836
],
[
"prod-eu-west-0",
"prod-us-central-0",
"prod-us-central-0",
"prod-us-central-0"
],
[
"230620",
"207319",
"47882",
"530708"
],
[
"samjewell19oct-prom",
"samjewell17sept-prom",
"samjewell-prom",
"samjewell10aug22-prom"
],
[
5.3875399226757095,
1.9381806733745142,
0.9908374801520498,
0.6280506758358745
]
]
}
},
{
"schema": {
"refId": "Threshold1: Included DPM per series",
"meta": {
"type": "timeseries-multi",
"custom": {
"resultType": "vector"
},
"executedQueryString": "Expr: sort_desc(\n sum by(cluster, id, name) (\n 60 * grafanacloud_instance_samples_per_second\n / grafanacloud_instance_active_series\n\n * on(id) group_left(name) grafanacloud_instance_info\n )\n)\nStep: 30s",
"preferredVisualisationType": "rawPrometheus"
},
"fields": [
{
"name": "Time",
"type": "time",
"config": {}
},
{
"name": "Value #Threshold1: Included DPM per series",
"type": "number",
"config": {}
}
]
},
"data": {
"values": [
[
1673433285836
],
[
6
]
]
}
},
{
"schema": {
"refId": "Max: 2x Included DPM",
"meta": {
"type": "timeseries-multi",
"custom": {
"resultType": "vector"
},
"executedQueryString": "Expr: sort_desc(\n sum by(cluster, id, name) (\n 60 * grafanacloud_instance_samples_per_second\n / grafanacloud_instance_active_series\n\n * on(id) group_left(name) grafanacloud_instance_info\n )\n)\nStep: 30s",
"preferredVisualisationType": "rawPrometheus"
},
"fields": [
{
"name": "Time",
"type": "time",
"config": {}
},
{
"name": "Value #Max: 2x Included DPM",
"type": "number",
"config": {}
}
]
},
"data": {
"values": [
[
1673433285836
],
[
12
]
]
}
}
]
}
]
},
{
"gridPos": {
"h": 7,
"w": 9,
"x": 15,
"y": 0
},
"id": 5,
"options": {
"content": "<table width=\"100%\">\n <tr>\n <th width=\"2%\">Panel</th>\n <td >gauge @ 9.4.0-47373pre</td>\n </tr>\n <tr>\n <th>Queries</th>\n <td>Average DPM per series[prometheus], Threshold1: Included DPM per series[prometheus], Max: 2x Included DPM[prometheus]</td>\n </tr>\n <tr>\n <th>Transforms (2)</th>\n <td>configFromData, configFromData</td>\n </tr>\n <tr><th>Data</th><td> 3 frames, 9 fields, 6 rows </td></tr>\n \n <tr>\n <th>Grafana</th>\n <td>9.4.0-47373pre (a9e39a108c) // Enterprise</td>\n </tr>\n </table>",
"mode": "html"
},
"title": "Debug info",
"type": "text"
},
{
"id": 6,
"title": "Original Panel JSON",
"type": "text",
"gridPos": {
"h": 13,
"w": 9,
"x": 15,
"y": 7
},
"options": {
"content": "{\n \"id\": 3,\n \"gridPos\": {\n \"h\": 6,\n \"w\": 21,\n \"x\": 0,\n \"y\": 6\n },\n \"type\": \"gauge\",\n \"title\": \"With second \\\"Config from query results\\\" transform: selecting 'config query' only give \\\"no options found\\\"\",\n \"transformations\": [\n {\n \"id\": \"configFromData\",\n \"options\": {\n \"configRefId\": \"Threshold1: Included DPM per series\",\n \"mappings\": [\n {\n \"fieldName\": \"Time\",\n \"handlerKey\": \"__ignore\"\n },\n {\n \"fieldName\": \"Value #Threshold1: Included DPM per series\",\n \"handlerKey\": \"threshold1\"\n }\n ],\n \"applyTo\": {\n \"id\": \"byType\",\n \"options\": \"number\"\n }\n }\n },\n {\n \"id\": \"configFromData\",\n \"options\": {}\n }\n ],\n \"datasource\": {\n \"uid\": \"grafanacloud-usage\",\n \"type\": \"prometheus\"\n },\n \"pluginVersion\": \"9.4.0-47373pre\",\n \"fieldConfig\": {\n \"defaults\": {\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"text\",\n \"value\": null\n }\n ]\n },\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"max\": 7,\n \"min\": 0\n },\n \"overrides\": []\n },\n \"options\": {\n \"reduceOptions\": {\n \"values\": true,\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"limit\": 1\n },\n \"orientation\": \"auto\",\n \"showThresholdLabels\": true,\n \"showThresholdMarkers\": true\n },\n \"targets\": [\n {\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"grafanacloud-usage\"\n },\n \"editorMode\": \"code\",\n \"exemplar\": false,\n \"expr\": \"sort_desc(\\n sum by(cluster, id, name) (\\n 60 * grafanacloud_instance_samples_per_second\\n / grafanacloud_instance_active_series\\n\\n * on(id) group_left(name) grafanacloud_instance_info\\n )\\n)\",\n \"format\": \"table\",\n \"instant\": true,\n \"legendFormat\": \"__auto\",\n \"range\": false,\n \"refId\": \"Average DPM per series\"\n },\n {\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"grafanacloud-usage\"\n },\n \"editorMode\": \"code\",\n \"exemplar\": false,\n \"expr\": \"scalar(grafanacloud_org_metrics_included_dpm_per_series)\",\n \"format\": \"table\",\n \"hide\": false,\n \"instant\": true,\n \"legendFormat\": \"__auto\",\n \"range\": false,\n \"refId\": \"Threshold1: Included DPM per series\"\n },\n {\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"grafanacloud-usage\"\n },\n \"editorMode\": \"code\",\n \"exemplar\": false,\n \"expr\": \"scalar(grafanacloud_org_metrics_included_dpm_per_series) * 2\",\n \"format\": \"table\",\n \"hide\": false,\n \"instant\": true,\n \"legendFormat\": \"__auto\",\n \"range\": false,\n \"refId\": \"Max: 2x Included DPM\"\n }\n ]\n}",
"mode": "code",
"code": {
"language": "json",
"showLineNumbers": true,
"showMiniMap": true
}
}
},
{
"id": 3,
"title": "Data from panel above (after transformations)",
"type": "table",
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"gridPos": {
"h": 7,
"w": 15,
"x": 0,
"y": 13
},
"options": {
"showTypeIcons": true
},
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"withTransforms": true,
"refId": "A"
}
]
},
{
"id": 100,
"title": "Data (before transformations)",
"type": "table",
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 13
},
"options": {
"showTypeIcons": true
},
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"withTransforms": false,
"refId": "A"
}
]
}
],
"schemaVersion": 37,
"title": "Debug: With second \"Config from query results\" transform: selecting 'config query' only give \"no options found\" // 2023-01-11 10:35:35",
"tags": [
"debug",
"debug-gauge"
],
"time": {
"from": "2023-01-11T04:35:35.065Z",
"to": "2023-01-11T10:35:35.065Z"
}
}
```
</details>
See that the second "Config from query results" transform just shows "No options found" for the Config query.
![image](https://user-images.githubusercontent.com/2903904/211784672-c2022e92-2f61-4b23-bbcc-5b12f2745a04.png)
## Or this:
To be able to transform the data to add an additional "value" column, which I could then reference in the "Config from query results" transform:
| Key | Value |
|--|--|
| Panel | gauge @ 9.4.0-47373pre |
| Grafana | 9.4.0-47373pre (a9e39a108c) // Enterprise |
<details><summary>Panel debug snapshot dashboard</summary>
```json
{
"panels": [
{
"id": 2,
"gridPos": {
"h": 13,
"w": 15,
"x": 0,
"y": 0
},
"type": "gauge",
"title": "Reproduced with embedded data",
"transformations": [
{
"id": "calculateField",
"options": {
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"binary": {
"left": "Value #Included DPM per series",
"reducer": "sum",
"operator": "*",
"right": "2"
},
"alias": "Max"
}
},
{
"id": "configFromData",
"options": {
"applyTo": {
"id": "byType",
"options": "number"
},
"configRefId": "Included DPM per series",
"mappings": [
{
"fieldName": "Time",
"handlerKey": "__ignore"
},
{
"fieldName": "Value #Included DPM per series",
"handlerKey": "threshold1"
}
]
}
}
],
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"pluginVersion": "9.4.0-47373pre",
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
},
"color": {
"mode": "thresholds"
},
"max": 7,
"min": 0
},
"overrides": []
},
"options": {
"reduceOptions": {
"values": true,
"calcs": [
"lastNotNull"
],
"fields": "",
"limit": 1
},
"orientation": "auto",
"showThresholdLabels": true,
"showThresholdMarkers": true
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"queryType": "snapshot",
"snapshot": [
{
"schema": {
"refId": "Average DPM per series",
"meta": {
"type": "timeseries-multi",
"custom": {
"resultType": "vector"
},
"executedQueryString": "Expr: sort_desc(\n sum by(cluster, id, name) (\n 60 * grafanacloud_instance_samples_per_second\n / grafanacloud_instance_active_series\n\n * on(id) group_left(name) grafanacloud_instance_info\n )\n)\nStep: 30s",
"preferredVisualisationType": "rawPrometheus"
},
"fields": [
{
"name": "Time",
"type": "time",
"config": {}
},
{
"name": "cluster",
"config": {
"filterable": true
},
"type": "string"
},
{
"name": "id",
"config": {
"filterable": true
},
"type": "string"
},
{
"name": "name",
"config": {
"filterable": true
},
"type": "string"
},
{
"name": "Value #Average DPM per series",
"type": "number",
"config": {}
}
]
},
"data": {
"values": [
[
1673433285836,
1673433285836,
1673433285836,
1673433285836
],
[
"prod-eu-west-0",
"prod-us-central-0",
"prod-us-central-0",
"prod-us-central-0"
],
[
"230620",
"207319",
"47882",
"530708"
],
[
"samjewell19oct-prom",
"samjewell17sept-prom",
"samjewell-prom",
"samjewell10aug22-prom"
],
[
5.3875399226757095,
1.9381806733745142,
0.9908374801520498,
0.6280506758358745
]
]
}
},
{
"schema": {
"refId": "Included DPM per series",
"meta": {
"type": "timeseries-multi",
"custom": {
"resultType": "vector"
},
"executedQueryString": "Expr: sort_desc(\n sum by(cluster, id, name) (\n 60 * grafanacloud_instance_samples_per_second\n / grafanacloud_instance_active_series\n\n * on(id) group_left(name) grafanacloud_instance_info\n )\n)\nStep: 30s",
"preferredVisualisationType": "rawPrometheus"
},
"fields": [
{
"name": "Time",
"type": "time",
"config": {}
},
{
"name": "Value #Included DPM per series",
"type": "number",
"config": {}
}
]
},
"data": {
"values": [
[
1673433285836
],
[
6
]
]
}
}
]
}
]
},
{
"gridPos": {
"h": 7,
"w": 9,
"x": 15,
"y": 0
},
"id": 5,
"options": {
"content": "<table width=\"100%\">\n <tr>\n <th width=\"2%\">Panel</th>\n <td >gauge @ 9.4.0-47373pre</td>\n </tr>\n <tr>\n <th>Queries</th>\n <td>Average DPM per series[prometheus], Included DPM per series[prometheus]</td>\n </tr>\n <tr>\n <th>Transforms (2)</th>\n <td>calculateField, configFromData</td>\n </tr>\n <tr><th>Data</th><td> 2 frames, 7 fields, 5 rows </td></tr>\n \n <tr>\n <th>Grafana</th>\n <td>9.4.0-47373pre (a9e39a108c) // Enterprise</td>\n </tr>\n </table>",
"mode": "html"
},
"title": "Debug info",
"type": "text"
},
{
"id": 6,
"title": "Original Panel JSON",
"type": "text",
"gridPos": {
"h": 13,
"w": 9,
"x": 15,
"y": 7
},
"options": {
"content": "{\n \"id\": 4,\n \"gridPos\": {\n \"h\": 6,\n \"w\": 21,\n \"x\": 0,\n \"y\": 12\n },\n \"type\": \"gauge\",\n \"title\": \"Use \\\"Config from query results\\\" after \\\"add field from calculation\\\". Again \\\"config query\\\" has \\\"no options found\\\"\",\n \"transformations\": [\n {\n \"id\": \"calculateField\",\n \"options\": {\n \"mode\": \"binary\",\n \"reduce\": {\n \"reducer\": \"sum\"\n },\n \"binary\": {\n \"left\": \"Value #Included DPM per series\",\n \"reducer\": \"sum\",\n \"operator\": \"*\",\n \"right\": \"2\"\n },\n \"alias\": \"Max\"\n }\n },\n {\n \"id\": \"configFromData\",\n \"options\": {\n \"applyTo\": {\n \"id\": \"byType\",\n \"options\": \"number\"\n },\n \"configRefId\": \"Included DPM per series\",\n \"mappings\": [\n {\n \"fieldName\": \"Time\",\n \"handlerKey\": \"__ignore\"\n },\n {\n \"fieldName\": \"Value #Included DPM per series\",\n \"handlerKey\": \"threshold1\"\n }\n ]\n }\n }\n ],\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"grafanacloud-usage\"\n },\n \"pluginVersion\": \"9.4.0-47373pre\",\n \"fieldConfig\": {\n \"defaults\": {\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"text\",\n \"value\": null\n }\n ]\n },\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"max\": 7,\n \"min\": 0\n },\n \"overrides\": []\n },\n \"options\": {\n \"reduceOptions\": {\n \"values\": true,\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"limit\": 1\n },\n \"orientation\": \"auto\",\n \"showThresholdLabels\": true,\n \"showThresholdMarkers\": true\n },\n \"targets\": [\n {\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"grafanacloud-usage\"\n },\n \"editorMode\": \"code\",\n \"exemplar\": false,\n \"expr\": \"sort_desc(\\n sum by(cluster, id, name) (\\n 60 * grafanacloud_instance_samples_per_second\\n / grafanacloud_instance_active_series\\n\\n * on(id) group_left(name) grafanacloud_instance_info\\n )\\n)\",\n \"format\": \"table\",\n \"instant\": true,\n \"legendFormat\": \"__auto\",\n \"range\": false,\n \"refId\": \"Average DPM per series\"\n },\n {\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"grafanacloud-usage\"\n },\n \"editorMode\": \"code\",\n \"exemplar\": false,\n \"expr\": \"scalar(grafanacloud_org_metrics_included_dpm_per_series)\",\n \"format\": \"table\",\n \"hide\": false,\n \"instant\": true,\n \"legendFormat\": \"__auto\",\n \"range\": false,\n \"refId\": \"Included DPM per series\"\n }\n ]\n}",
"mode": "code",
"code": {
"language": "json",
"showLineNumbers": true,
"showMiniMap": true
}
}
},
{
"id": 3,
"title": "Data from panel above (after transformations)",
"type": "table",
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"gridPos": {
"h": 7,
"w": 15,
"x": 0,
"y": 13
},
"options": {
"showTypeIcons": true
},
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"withTransforms": true,
"refId": "A"
}
]
},
{
"id": 100,
"title": "Data (before transformations)",
"type": "table",
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 13
},
"options": {
"showTypeIcons": true
},
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 2,
"withTransforms": false,
"refId": "A"
}
]
}
],
"schemaVersion": 37,
"title": "Debug: Use \"Config from query results\" after \"add field from calculation\". Again \"config query\" has \"no options found\" // 2023-01-11 10:38:44",
"tags": [
"debug",
"debug-gauge"
],
"time": {
"from": "2023-01-11T04:38:44.017Z",
"to": "2023-01-11T10:38:44.017Z"
}
}
```
</details>
Same thing here: "No options found"
![image](https://user-images.githubusercontent.com/2903904/211785214-ff505316-936f-4d1c-aa27-2b0675cda91b.png)
### As a result there's no way to configure both the Threshold1 and the Max from a Prometheus datasource query.
**How to reproduce it (as minimally and precisely as possible)**:
- Import the panels I've shared above
- Edit them
- Click the "Transform" tab
- Try to set the Config query. See "no options found"
**Anything else we need to know?**:
No
**Environment**:
See the panels pasted in above, via the "Get help" feature.