User prompt to select metric (field key) in a dashboard

Hello. I am using the latest version of Grafana SSO and Influxdb as my database.

I have an Influxdb measure that contains a timestamp and multiple fields, each one being the value of a different metric: temperature, pressure, flow rate, etc.

timestamp temperature pressure flow …etc
2021-06-24 08:22:30 70 13,2 7 …

I want to create a prompt in the dashboard to provide the users to choose the metric they want to plot in a dashboard. Since I am working with Influxdb, I was able to get the metric names and place them in a variable by performig the following query:

import “influxdata/influxdb/schema” schema.tagKeys(bucket: “myBucket”)

So now the users can select any metric in a prompt.
But now I do not know how to filter the query in Grafana to plot only the metric chosen by the user… Do any of you know how to do this?

Thanks in advance!

This topic was automatically closed after 365 days. New replies are no longer allowed.