One of my customers jumped onto Grafana v12 (before I did) and reported one of my dashboards now being broken (it worked fine with previous 11.x versions). I immediately reproduced the problem just by upgrading from 11.4 to 12.0. If I roll back to 11.x, the problem goes away.
The screenshot below shows part of the MS SQL query behind my dashboard, and the problem is rather evident. I’m initializing two SQL variables, @ObjectName and @CounterName (both deal with Windows performance counters), both are initialized with variables provided by Grafana, $PerfCounterObjects and $PerfCounterNames. I surround these with single quotes, as all strings should be.
The query inspector shows the first variable has been substituted correctly, and has the expected single quotes (highlighted in green).
The second variable OTOH somehow substituted the value for the variable, but also added its own pair of single quotes around it, doubling them (highlighted in red - ‘’% Free space’’ instead of ‘% Free Space’).
Obviously I should be consistent, so if I remove both sets of single quotes in my query, then the first line (setting @ObjectName) now introduces its own syntax error, as the string should be surrounded by single quotes. But if I only drop the single quotes around ‘$PerfCounterNames’, then I can get data again.
I could make a special case out of it (and leave out the single quotes around $PerfCounterNames), but then I’d be breaking 11.x. I’d hate to make a special case based on the version of Grafana being used.
This is possibly important: My panel is repeated based on $PerfCounterNames (I repeat the panel for every value returned by the SQL query that populates $PerfCounterNames). As such, this is sounding to me similar to:
It’s not clear to me however how that solution might apply in my case.
FWIW, both $PerfCounterObjects and $PerfCounterNames variables are populated from SQL queries. $PerfCounterObjects is used to fill in a dropdown. The user selects a Performance Counter Object, and then the Perf Counter Names (for that object) are fetched, and then I end up with a separate panel for every name. Worked beautifully until v12.
What can I do here, that is not version-dependent, to solve this problem? If this requires a bug fix, I’m okay with telling my customer to wait for it.