I want to add a custom variable that allows me to filter the data where tag value for "process" equals to the variable value in grafana dashboard. I am able to add a custom variable to the dashboard with value options "process1", "process2" and "process3", but when I use this variable in the query as
|> filter(fn: (r) => r["Process ID"] == ${process})
it is giving me error undefined identifier process2.
Although when I replace the variable ${process}
with "process2"
the query works correctly and filters out the data by that particular process, but it doesn't work when I use variable.
How can I fix this issue?
I tried using the variable in the flux query as
|> filter(fn: (r) => r["Process ID"] == ${process})
but it is not working
${process}
substitutes variable without quotes. Simply use"${process}"
instead