Nested constant variables, or cleanly insert clauses

I have a situation where the query structure in the Grafana 5.2.4 panel apparently does not permit me to cleanly add an InfluxDB clause like ((foo = ‘key1’ AND bar = ‘value1’) OR (foo = ‘key2’ AND bar = ‘value2’)) , in order to accommodate differences among various environments targeted by the dashboard, so I use an ugly kludge to insert the clause. There’s no aprioristic way to filter in the right value for each environment.

It would help to be able to insert the clause cleanly.

Or, if there were a way to use either a dictionary or a compound variable name in the query, it would be easier and cleaner to get the right query to InfluxDB. The former would be, say, a constant value (JSON object?) with keys “key1” and “key2”, so used perhaps as $mydictionary[$foo] . The latter would be a constant-like value like $value$foo , combined with a set of other variables such as $valuekey1 and $valuekey2 .

Am I missing something?

Yes, this use case is not supported yet.

1 Like

Hi is this use case still not supported? If so, do you have any suggestions for how to achieve similar functionality? Thanks!

In newer versions of Grafana, you apparently can write your own InfluxDB query, instead of constructing it in the UI. (I don’t know if this is possible in the UI rather than in the dashboard JSON. It looks like the latter, since I still see a kludge in the query. Someone else is maintaining the dashboard now.) This isn’t friendly, but at least it doesn’t require a kludge, and the query is easy to read.

In older versions of Grafana, the kludge involved putting a single quote at the end of the right side of a bogus not-equals comparison, then injecting a more-detailed query immediately after the quote in that RHS, finishing up with a comparison lacking a final single quote.