0

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

1
  • It seems like ${process} substitutes variable without quotes. Simply use "${process}" instead
    – markalex
    Commented Apr 8 at 11:00

1 Answer 1

0

Try to use advanced variable format options:

  |> filter(fn: (r) => r["Process ID"] == ${process:doublequote})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.