Yet another legend renaming problem

I have the following query, which displays the value nicely but I don’t understand how to change the label. If I put anything in Alias, the graph is suddenty empty. I guess I have not understand yet what “alias” means :wink:

The query looks like this:

SELECT mean("serverrack8") FROM "1-wire" WHERE ("host" = 'ecap-s010')
AND $timeFilter GROUP BY time($__interval) fill(null)

I tried with

SELECT mean("serverrack10"), 'Rack 10' as metric FROM "1-wire" WHERE
("host" = 'ecap-s010') AND $timeFilter GROUP BY time($__interval) fill(null)

But this shows “No data”.

How can I set the legend entry for this? I’d preferably use the field name (in this case serverrack8) but setting that manually is also fine… where do I do this?

Welcome

Please provide some sample data for your 1-wire db?

host,serverrack8,serverrack10
ecap-s010,20,30

Enough obfuscated sample data to help us help you

The only host is ecap-s010 and the columns are namend serverrack1serverrack15, that’s basically it.

I think that it’s somehow a bug in Grafana since in the Explore mode, I am able to recreate the graph and when I put anything in ALIAS, the legend is updated accordingly. If I do the same in the dashboard, the Graph simply resets and does not show anything. I am running Grafana 8.3.4 but will update later to the latest v9, maybe that solves it and then I can manually enter the aliases.

However, if you come up with a solution how to rename them based on the column names, that would already be very helpful. So when selecting mean("serverrack10"), the legend entry should be serverrack10. If that is even possible?

1 Like

OK so I guess it’s because of the older version I am using. I will update today and report back. Many thanks for the cross-check! If I do exactly the same, the legend is 1-wire.mean.

I upgraded to Grafana v9.0.2 but still have the same issue. Once I type something into Alias, I get an empty plot.

Here is before (empty Alias):

and here right after typing something into Alias

what happens when you change it to the a SQL like query like I have it. It could be a bug.

I have the exact same SQL line. Which version do you use? Your label says “Alias by” and mine is “ALIAS”, so there is probably a difference… I am using Grafana 9.0.2 now.

I have this

you have this

I am using 8.5.2

OK I guess it’s a bug then? I’ll go ahead with a bug-report.

let me try it in 9.0.2 also
could be a regression bug

1 Like

Btw. I ended up upgrading InfluxDB from 1.8 to 2.3 and then used flux to create the queries. To rename the labels, I am now using the “Transform” functionality with the “Rename regex” one, which is perfect!

Screenshot 2022-07-25 at 20.22.29

2 Likes

I realise that you’ve got this sorted, but I’ve got what I believe is a “fix” which is worth documenting for googlers of the future who stumble across this same issue.
I had set up a dashboard with 2 tables in it, renaming the ALIAS of one table did exactly what I wanted - it renamed the legend. For the other though, it simply hid the data.
What I noticed is that I had a field override set on the chart that wasn’t working.
image

I selected it and clicked the dustbin/delete button

Then I was able to set the alias
image
And we’re in business (I left 2 other fields without an alias for comparison)

2 Likes

Thank you SOOOOOO much. I was going crazy with this issue as I am brand-new to Grafana and couldn’t figure this out. This was exactly the fix, thank you for taking the time to post about it.

1 Like