I have a recurring requirement for dashboards where a user may pick from a variable dropdown and I then need other variables automatically set based on that variable.
This is fine when the secondary hidden variables can be queried from a datasource and I can use the primary variable in the datasource query. However, some of these variables are simply not queryable from datasources. For example:
Kubernetes cluster name: List pulled from prometheus using label_values(…)
Amazon cloudwatch log name: << not available anywhere
I had hoped that csv datasource plugin would allow me to setup a datasource where I could manually map values - however, I could not see a way to actually filter csv values for variables (i.e. setup a variable using csv datasource and select columnx where columny value is equal to another variable).
I have worked around the problem for now by installing mariadb on the server and manually creating some mapping tables. Then I have created a mysql datasource in Grafana and can then query that to transform the variables.
So my question is, is there a neater solution to this workaround? If not, might there be a plugin solution to this problem that could be developed? Ideally, I’d like to setup these variable mappings directly in Grafana.