Sorting Bar Gauge graph

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

  • What are you trying to achieve? I would like to have the metics sorted in the bar gauge

  • How are you trying to achieve it? I used sort() or sort_desc() function

  • What happened? , They only work with instant mode. I would like those to work with any type of results

  • What did you expect to happen? I expected the metrics to be sorted

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

   {
      "datasource": null,
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "displayName": "${__series.name}",
          "mappings": [],
          "max": 10,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 12,
        "y": 0
      },
      "id": 10,
      "options": {
        "displayMode": "gradient",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "text": {}
      },
      "pluginVersion": "8.2.6",
      "targets": [
        {
          "exemplar": true,
          "expr": "sort(avg(apache_ReqPerSec{Stage=~\"$stage\", Environment=~\"$environment\"}) by (host))",
          "format": "time_series",
          "instant": false,
          "interval": "",
          "legendFormat": "{{host}}",
          "refId": "A"
        }
      ],
      "title": "Apache Request/s",
      "type": "bargauge"
    },
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

No errors

  • Did you follow any online instructions? If so, what is the URL?
    I didn’t find any

Hey, am I the only one that needs that? not sure why I don’t get anything from the community… is there any feature request to support it?

Hi @tsharoni,

Thanks for opening this post.

Can you please try to reproduce this same issue on https://play.grafana.org/ and then share the dashboard link so that we can view it?

Thanks

I am not able to save, but this is what I created (using json exported):

    {
      "datasource": {
        "type": "prometheus",
        "uid": "000000008"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 13,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "000000008"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by(handler) (alertmanager_http_request_duration_seconds_bucket))",
          "instant": false,
          "interval": "",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "tsharoni test",
      "type": "bargauge"
    },

Hi,

I am not able to load this JSON into the Dashboard correctly as it shows a blank page.

Can you please share a screenshot or a small screencast/gif file so that we can see the actual issue you are having and then try to replicate on our test machine?

Thanks

Thank you for the screenshot but more for capturing the PromQL by which I can reproduce it easily :+1:

This seems to be a known issue:

I would recommend to subscribe to this issue to get up-to-date notification about its fix and maybe a possible workaround.

1 Like