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

Grafana 8.0 incorrectly adding prefix label to grouped data #35390

Closed
risoms opened this issue Jun 8, 2021 · 9 comments · Fixed by #35839
Closed

Grafana 8.0 incorrectly adding prefix label to grouped data #35390

risoms opened this issue Jun 8, 2021 · 9 comments · Fixed by #35839

Comments

@risoms
Copy link

risoms commented Jun 8, 2021

What happened:
Updated to Grafana 8.0. I'm noticing all of my plots are adding as a prefix the variable name used. If a function is used (i.e. COUNT(), the function would be prefixed

What you expected to happen:

  • Plot legend to display as expected

How to reproduce it (as minimally and precisely as possible):

  • Upgrade to Grafana 8.0
  • Create a timeseries or plot using psql

Anything else we need to know?:

Environment:

  • Grafana version: v8.0.0 (41f0542)
  • Data source type & version: PSQL 10
  • OS Grafana is installed on: Linux
  • User OS & Browser: OSX, Chrome
  • Grafana plugins: None
  • Others:
    image
@risoms risoms changed the title Grafana 8.0 adding prefix to grouped data Grafana 8.0 incorrectly adding prefix label to grouped data Jun 8, 2021
@torkelo
Copy link
Member

torkelo commented Jun 8, 2021

Are you using the built in Postgres data source? can you show you query?

@torkelo torkelo added area/backend/db/postgres needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc labels Jun 8, 2021
@torkelo
Copy link
Member

torkelo commented Jun 8, 2021

I can replicate this. thanks for reporting this!

@torkelo torkelo added this to the 8.0.1 milestone Jun 8, 2021
@torkelo torkelo added type/bug and removed needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc labels Jun 8, 2021
@risoms
Copy link
Author

risoms commented Jun 8, 2021

@torkelo Just in case it's still needed. Here is an example query

SELECT
    $__timeGroupAlias(time, 30m, NULL),
    name AS metric,
    count(iv) AS value
FROM source
GROUP BY 1, 2
ORDER BY 1

@torkelo
Copy link
Member

torkelo commented Jun 8, 2021

@risoms the value column in that query is value but grafana shows it as count, can you show the query inspector / JSON / DataFrame structure?`

@risoms
Copy link
Author

risoms commented Jun 8, 2021

Since the data is coming from work. I can't unfortunately.

@deathchurch
Copy link

This also happens with the MSSQL datasource, to reproduce it you can use the example on the MSSQL datasource documentation page, any graph will have the legend of value {then the metric name}.

@Vizzyy
Copy link

Vizzyy commented Jun 9, 2021

Screen Shot 2021-06-09 at 5 15 19 PM
+1

All my metrics are now prefixed by "value" (using mysql)

example query:

SELECT
  UNIX_TIMESTAMP(timestamp) AS "time",
  hostname AS metric,
  value
FROM server_metrics
WHERE
  $__timeFilter(timestamp) AND
  metric = 'cpu_util' AND             
  hostname in (${host.csv})
ORDER BY timestamp

@torkelo
Copy link
Member

torkelo commented Jun 10, 2021

Temporary fix is to update SQL and return value AS Value (capital V)

@torkelo torkelo modified the milestones: 8.0.1, 8.0.2 Jun 11, 2021
@risoms
Copy link
Author

risoms commented Jun 13, 2021

@torkelo Upgrade to which version of postgres?

@ivanahuckova ivanahuckova modified the milestones: 8.0.2, 8.0.3 Jun 14, 2021
marefr added a commit that referenced this issue Sep 10, 2021
Improves SQL data sources documentation in regards to Grafana 8 changes 
and adds some additional upgrade notes in regards to this.

Ref #35390
Ref #38666

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
marefr added a commit that referenced this issue Sep 13, 2021
Improves SQL data sources documentation in regards to Grafana 8 changes
and adds some additional upgrade notes in regards to this.

Ref #35390
Ref #38666

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit 0bb7d50)
marefr added a commit that referenced this issue Sep 13, 2021
Improves SQL data sources documentation in regards to Grafana 8 changes
and adds some additional upgrade notes in regards to this.

Ref #35390
Ref #38666

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit 0bb7d50)
marefr added a commit that referenced this issue Sep 13, 2021
Improves SQL data sources documentation in regards to Grafana 8 changes
and adds some additional upgrade notes in regards to this.

Ref #35390
Ref #38666

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit 0bb7d50)
marefr added a commit that referenced this issue Sep 13, 2021
Improves SQL data sources documentation in regards to Grafana 8 changes
and adds some additional upgrade notes in regards to this.

Ref #35390
Ref #38666

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit 0bb7d50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment