Skip to content

Bar gauge doesn't show display name when single value is returned from prometheus query #48983

@uselessjargon

Description

@uselessjargon

What happened:
In a bar gauge with a prom query like sum(aobiz_cust_node_gauge2{custtag=~"cnp"}) by (ostype) the bar chart displays all 'ostype's in the proper format (ostype name, bar and value) when there is more than one 'ostype' to display. However, when there is only a single 'ostype' returned, the display name for the 'ostype' does not appear. For example, if all nodes for the dashboard are of ostype 'linux-rh7.9' that ostype name is not displayed in the chart.

What you expected to happen:
The ostype name should display in the bar chart. I believe it's the legend value that is not being displayed.

How to reproduce it (as minimally and precisely as possible):
This is what the bar chart looks like when multiple 'ostypes' are returned from the query:
image

This is what bar chart looks like when only one 'ostype' is returned from the query. Notice the name 'linux-rh7.9' is not displayed and the bar itself is not filled in):
image

Return query:
image

Anything else we need to know?:

Environment:

  • Grafana version: Version 8.5.2 (commit: 90701be, branch: HEAD)
  • Data source type & version: prometheus, version 2.35.0
  • OS Grafana is installed on: CentOS Linux release 7.9.2009 (Core)
  • User OS & Browser: macOS Monterey 12.3.1 with FF or Chrome
  • Grafana plugins: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions