If you need to change an entire query, you can map those to custom variable (given that the key value pairs are not used), e.g.: foo : sum(rate(go_gc_cycles_automatic_gc_cycles_total[5m])), bar : vector(0)
and then just use the variables like that:
Only the name of the metric is changing the query, right. And yes, I’d like to change the entire query but per panel. I could pass the query as a custom value but imagine there are N panels and want to replace for each one.
I don’t think I understand tbh. Let’s say you have a dashboard with two panels - panelA and panelB. Also, you have a variable there with possible values foo, bar, and baz (I know you have the key-value pairs, but for simplicity let’s omit those).
panelA has query: sum(rate(metric_foo)) and
panelB has query avg(rate(metric_foo))
Now I change foo to bar in the variable list. What would you like to happen? Also please tag me in your response, cause I don’t get notifications and otherwise I’m not going to see your response
Thanks @dawiddebowski, but what if i have multiple panels and want to change on each based on provided variable? It seems this way would only support for one panel. (Since we can only pass one query per one variable)
You could always create one hidden variable per one panel. But I fail to understand why would you want to change all the queries. What’s your use-case for that? I mean I would find it pretty confusing.