Grafana on Premise caching SQL Result

  • What Grafana version and what operating system are you using?
    v9.2.0

I have a Grafana dashboard displaying multiple panels which display html with variables in them which retrieve data from a MSSQL source. The dashboard has recently been reported as displaying false information.

All of the variables are set to refresh on load but when they load they are displaying data from over two years ago.
If I change the variable to refresh on time change, they initially load with old data but then when I change the time range the data refreshes with the current (correct) data.
If I switch back the variable to refresh on page load, it goes back to 2 year old data.

I know on premise has no caching in it but it was working until recently and the dashboard hasnā€™t changed in the last year.

Any ideas?

Thanks

M

Just adding to this, it looks like its the variable thatā€™s doing this.

If I put the SQL in a Stat panel then the value displays correctly but if I put the SQL in a variable and display that variable using ā€œSelect $variablenameā€ in the stat panel OR use a text panel and apply $variablename as the text then it seems to load a cached version of the variable.

Also, some of my variables are populated with values returned from other variables. I order the variables so that the ones required for other variables are at the top of the list.
If the linked variables werenā€™t returning the data before the required variable had completed then the result should be no data, no cached data.

Iā€™m hoping this might be useful to somebody.

This has been working for some time now, but something has changed

Thanks

1 Like

OK, so I have switched most of the text panels to table or single stat columns. Putting the SQL from the variable into the data panel. This is now refreshing as expected.
However, I kept 3 variables (One custom list, 2 SQL lookups using the custom list and a parameter) and was unable to use the SQL based variables in the table or SingleStat SQL lookup.


Var1 = A,B,C
Var2 = Select value from table where column = $Var1
Var3 = Select value2 from table2 where column = $Var2

There issue seems to be that the variables are loading a cached version of the variable and not refreshing it on load. if I change the variable to refresh on time change, then it does refresh but putting it back on ā€œOn loadā€ reverts it back to this ā€œcached versionā€

I tried re-creating the dashboard from scratch and within about 4 panels experienced the issue again.

Hopefully somebody will be able to find the bug

OK, so I updated from v9.2.0 to v9.2.3 today and it seems like the issue has gone away.

Looking at the changes there only seems to be one closely related bug fix but not sure if this affected me

Just curious to know which bugfix solved it.