Stat plugin: ignores alias from db query

  • What is your Grafana version?
  • Are you using Grafana Cloud or self-hosted Grafana?
    self hosted
  • List the datasource associated with the alert
  • What are you trying to achieve?
    Display multiple values in a Stat plugin

  • How are you trying to achieve it?
    using 2 mssql sources and 1 Expression

  • What happened?
    When using a select query as alias Stat plugin overrides it with Value

  • What did you expect to happen?
    That Stat plugin would respect my query alias

SELECT COUNT(1) AS 'Failure'
  FROM [researchteam].[dbo].[chronogram]
 WHERE varname = 'op2250_3_tcy'

This maybe? also change around the settings on the right hand side to make sure it shows the name and Value, but I think you have that there

Thanks @T_GrumpyEngineer but that is a no go with alias as ‘Percentage’
Might it be a bug in the plugin itself? or maybe there is some other way of aliasing via transformation

Update: @T_GrumpyEngineer this issue only happens when you have an expression added. Definitely a bug Stats Plugin Label does not reflect sql AS alias · Issue #48868 · grafana/grafana · GitHub


Yeah sorry only noticed you used the expressions, I tried using them before but just worked around by doing the maths in SQL first, only suits if it’s the same datasource

1 Like