I’m trying to run a metric to create a panel in a Grafana Dashboard based on the value of a datasource type variable. I created an “environment” variable that has the specific set of Prometheus datasources I want and within each panel/datasource, I need an specific value to be set in some metric query. For example:
environment: datasource_XXX, datasource_YYY
If user selects datasource_YYY, then query should have
metric{field1:”some_YYY_value”}
Based on a predefined mapping like:
datasource_XXX -> some_XXX_value
datasource_YYY -> some_YYY_value
The name of the datasource is not the same to the value I want to use in the metric field filter.
I’ve tried value mappings and transformations with no avail. I can’t use chain variables since the source one is a datasource variable. Any idea?