Apply variables to all queries in a dashboard

Hi,

I’m new to Grafana.

In my setup I have a centeal Prometheus instance and a couple of Prometheus agents which each send their metrics to the central Prometheus instance, each agent adds a label with its name as value.

In Grafana, I want to add a variable to an existing dashboard to filter data by agent.
So I added a query variable with the label set by the agents.

My question: is there any way to have this new variable applied to all queries in the existing dashboard?

I’m trying to save myself from editing each query in the dashboard (and the others dashboards which need the same filter).

“Ad-hoc filters” do what I want and are added dynamically to existing queries but I don’t find a way to get this behavior for “query” variables.

Update:
alternatively, is there any possibility to add multiple Prometheus datasources which point to the same instance but add global label filters?
I tried the “custom query parameters” option but I might have done it wrong, also didn’t find any documentation about how to use it.