Config from query: min/max and thresholds does not work

  • What Grafana version and what operating system are you using?

    play.grafana.org (Grafana v10.4.0-65039 (da894994d4))

  • What are you trying to achieve?

    Building a stat panel with min/max and 2 thresholds from a query using the config query transformation (with the pre-configured base threshold color). I made the demo below using the gauge panel since it better displays the min/max and threshold values - and I believe the issue is the same for both.

    See this demo dashboard

  • How are you trying to achieve it?

    Using the “Config from query” transformation built into grafana

  • What happened?

    I’m not exactly sure.

  • What did you expect to happen?

    That the “Demo: config from query” looked the same as the “Demo: static config from UI” panel

  • Can you copy/paste the configuration(s) that you are having problems with?

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Demo: config from query should be identical to Demo: static config from UI",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 2688,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "grafana-testdata-datasource",
        "uid": "9cY0WtPMz"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 10,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 4
              },
              {
                "color": "orange",
                "value": 6
              }
            ]
          },
          "unitScale": true
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "minVizHeight": 75,
        "minVizWidth": 75,
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "sizing": "auto"
      },
      "pluginVersion": "10.4.0-65039",
      "targets": [
        {
          "alias": "",
          "csvContent": "min,max,threshold_lower,threshold_upper\n0,10,4,6",
          "datasource": {
            "type": "grafana-testdata-datasource",
            "uid": "9cY0WtPMz"
          },
          "hide": true,
          "refId": "config",
          "scenarioId": "csv_content"
        },
        {
          "csvContent": "value\n1",
          "datasource": {
            "type": "grafana-testdata-datasource",
            "uid": "9cY0WtPMz"
          },
          "refId": "B",
          "scenarioId": "csv_content"
        }
      ],
      "title": "Demo: static config from UI",
      "transformations": [],
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "grafana-testdata-datasource",
        "uid": "9cY0WtPMz"
      },
      "description": "Broken min/max/thresholds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 1,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 0
              },
              {
                "color": "orange",
                "value": 1
              }
            ]
          },
          "unitScale": true
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 2,
      "options": {
        "minVizHeight": 75,
        "minVizWidth": 75,
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "sizing": "auto"
      },
      "pluginVersion": "10.4.0-65039",
      "targets": [
        {
          "alias": "",
          "csvContent": "min,max,threshold_lower,threshold_upper\n0,10,4,6",
          "datasource": {
            "type": "grafana-testdata-datasource",
            "uid": "9cY0WtPMz"
          },
          "hide": false,
          "refId": "config",
          "scenarioId": "csv_content"
        },
        {
          "csvContent": "value\n1",
          "datasource": {
            "type": "grafana-testdata-datasource",
            "uid": "9cY0WtPMz"
          },
          "refId": "B",
          "scenarioId": "csv_content"
        }
      ],
      "title": "Demo: config from query",
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byFrameRefID",
              "options": "B"
            },
            "configRefId": "config",
            "mappings": [
              {
                "fieldName": "threshold_lower",
                "handlerKey": "threshold1"
              },
              {
                "fieldName": "threshold_upper",
                "handlerKey": "threshold1"
              }
            ]
          }
        }
      ],
      "type": "gauge"
    }
  ],
  "refresh": "",
  "schemaVersion": 39,
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Demo: config from query not always working",
  "uid": "a109d4bb-f21d-48b0-ac67-5d171916ca84",
  "version": 1,
  "weekStart": ""
}
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

    Not that I have found.

  • Did you follow any online instructions? If so, what is the URL?

    I adapted this example from torkelo