What is the sequence order of queries sent by grafana to datasource server?
And which grafana component defines it?
In my grafana 4.6.2 dashboard with graph panel and clickhouse datasource I’m using ~5 linked (hierarchical) template variables (ex.,
A,B,C,D,E,F) with “Query” type, refresh “On Time Range Change” and their values filled from clickhouse queries like:
select A from ... select B from ... where a=$A ... select C from ... where a=$A and b=$B ... ...
and metrics query in graph panel uses these template variables:
SELECT ... FROM DB.TABLE WHERE $timeFilter AND field_a=$a AND field_b=$B ...
I noticed that when value for template variable
$A is selected(changed) from dropdown too fast metrics query after template vars substitution gets malformed with some (typically last) variable expanded as empty string.
Naturally, this causes syntax error responce from DB and failure to draw graph. Simple click on dashboard refresh icon makes it work fine again.
Chrome devtools and apache log show that in case of problem some queries for template variables are sent after the main metrics query.