Choose two different type of data source by choosing a variable

Hi,

We want to create a variable that allows us to select multiple datasources .
From what we tested, it looks like it is only possible to create a variable per datasource.

For ex : we may have a different datasources per environment, like prometheus-dev, elastic-dev, prometheus-uat, elastic-uat, prometheus-prod, elastic-prod.
We want to create a variable called ‘Environment’ with options - dev,uat or prod.
Based on the 'Environment’variable, the respective datasources get referred and the results of the query change accordingly.

Is it something available or possible to do on grafana? If not, can we make a feature request?
Please comment.

1 Like

Hi,

We want to create a variable that allows us to select multiple datasources.

From what we tested, it looks like it is only possible to create a variable
per datasource.

For ex : we may have a different datasources per environment, like
prometheus-dev, elastic-dev, prometheus-uat, elastic-uat, prometheus-prod,
elastic-prod. We want to create a variable called ‘Environment’ with
options - dev,uat or prod. Based on the 'Environment’variable, the
respective datasources get referred and the results of the query change
accordingly.

Taking your example - you have:

prometheus-dev,
elastic-dev,
prometheus-uat,
elastic-uat,
prometheus-prod,
elastic-prod

So, you set “Environment” to be “uat”.

What then is your data source - elastic or prometheus?

How does Grafana know which one you want, without another variable defining
that?

Antony.

We have a common dashboard for both Prometheus and elastic and the environment variable should take care of datasource.

So, when we choose uat. We are expecting the Prometheus query panels to have prometheus-uat datasource and elastic query panels to have elastic-uat datasource with using single variable environment.

Hi, Any update?
Can someone come back on this?