-
What Grafana version and what operating system are you using?
Grafana Cloud -
What are you trying to achieve?
Inject multiple values into Flux query for dashboard panel -
How are you trying to achieve it?
Using variables from a Flux metadata query -
What happened?
Works with single values, fails with multiple -
What did you expect to happen?
Works with single, multiple, all -
Can you copy/paste the configuration(s) that you are having problems with?
Basically I am using a query variable where I want to be able to use multiple values in my dashboard. If one is selected, it inputs the string into the query. When using multiple values from the variable, they are input as comma seperated values in curly brackets. My query then returns empty. How do I use this with Flux to get multiple values in my dashboard panel?
Query Variable:
import “influxdata/influxdb/schema”
schema.measurementTagValues(
bucket: “TrainingLogProd”,
tag: “strategy”,
measurement: “modelTraining”,
)
Flux query:
from(bucket: “TrainingLogProd”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “modelTraining”)
|> filter(fn: (r) => r[“strategy”] == “${Strategy}”)
|> filter(fn: (r) => r[“_field”] == “accuracy”)
Single value selected:
from(bucket: “TrainingLogProd”)
|> range(start: 2023-01-19T18:47:53.902Z, stop: 2023-01-26T18:47:53.902Z)
|> filter(fn: (r) => r[“_measurement”] == “modelTraining”)
|> filter(fn: (r) => r[“strategy”] == “strategy1”)
|> filter(fn: (r) => r[“_field”] == “accuracy”)
Multiple values selected:
from(bucket: “TrainingLogProd”)
|> range(start: 2023-01-19T18:47:53.902Z, stop: 2023-01-26T18:47:53.902Z)
|> filter(fn: (r) => r[“_measurement”] == “modelTraining”)
|> filter(fn: (r) => r[“strategy”] == “{strategy1, strategy2, strategy3}”)
|> filter(fn: (r) => r[“_field”] == “accuracy”)