Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
uselessjargon opened this issue May 14, 2022 · 14 comments

Comments

@uselessjargon
Copy link

uselessjargon commented May 14, 2022

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
@uselessjargon
Copy link
Author

Here's a screenshot of the bar chart query
image

@torkelo
Copy link
Member

torkelo commented May 16, 2022

This is by design, so that you can use the panel title for name if you only have one gauge.

You can change it in the stat syles / text mode option

Screenshot from 2022-05-16 11-22-10

@torkelo torkelo closed this as completed May 16, 2022
@uselessjargon uselessjargon changed the title Bar charts don't show display name when single value is returned from prometheus query Bar gauge doesn't show display name when single value is returned from prometheus query May 16, 2022
@uselessjargon
Copy link
Author

Hi @torkelo, thanks for the response. What version of Grafana are you running? There is no Stats/Text mode in the 'Bar Gauge.'

My apologies, as I stated "Bar Chart" in my title and issue previously, not 'Bar gauge' . I'll try to switch my graphs 'bar chart' to see if I can use it instead in the meantime.

image

@uselessjargon
Copy link
Author

The 'beta' Bar chart is not solving my issue. Can we re-open this one or should I open a new issue with the correct panel "Bar guage" vs "Bar chart".

Incidentally, using the panel title for the name with one gauge is not an option since these panel are generated dynamically based on the promQL query. Also, I still am not seeing that Stat Styles/Text Mode option in the Bar chart panel. Maybe I'm dense but it could be you are on previous version of Grafana where that exists.

@torkelo
Copy link
Member

torkelo commented May 16, 2022

Sorry i meant bar gauge, your screenshot is from bar gauge and it has an option to always show name and value

@uselessjargon
Copy link
Author

@torkelo thanks again for the response. It looks like you are actually looking at the Stat visualization (below screenshot), not the Bar gauge. There is no Stat Styles/Text Mode option in Bar gauge. I even went back to grafana 7.5 to check.

I guess I can open a feature request to have this same/similar option added to Bar gauge.

image

@torkelo
Copy link
Member

torkelo commented May 19, 2022

Hi, sorry, forgot that Bar gauge does not have this option.

You can work around this problem by specifying ${__field.displayName} in the Display name field under Standard options

@uselessjargon
Copy link
Author

You da man! Thanks for the work around! Works as I need now.

@petergsn
Copy link

${__field.displayName}

Hi Torkelo,

Where I need to add that,
image

Regards,
Peter G

@petergsn
Copy link

image
I am also facing same issue, Value is there but it is not displaying in bar gauge.
image
I am using KQL in Grafana.

@uselessjargon
Copy link
Author

@petergsn This is where I added it...
image

@petergsn
Copy link

Hi, I am getting below,
image

But I am looking for below one,
image
please advice if you have any idea, I am using KQL query,

alertsmanagementresources
|where ['type'] =~ 'microsoft.alertsmanagement/alerts'
and properties.essentials.targetResourceGroup in~ ('name')
and properties.essentials.monitorCondition in~ ('Fired','Resolved')
and properties.essentials.severity in~ ('Sev0')
and todatetime(properties.essentials.startDateTime) >= $__timeFrom
and todatetime(properties.essentials.startDateTime) <= $__timeTo
|project name, properties.essentials.severity
|summarize count() by name

But it works perfectly if multiple values are there.
image

@anton-bystrov
Copy link

Hello @petergsn! I catch the same issue, and for me working ${__field.labels} Also I found more details here https://grafana.com/docs/grafana/latest/panels-visualizations/configure-standard-options/

@AndreBooysen
Copy link

AndreBooysen commented Apr 30, 2024

Hi, just ran into the same issue on the Bar Gauge where I have a score card repeating for each area. the ${__field.labels} work around resolved it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants