In Grafana I need to create a PromQL query to select some metrics whose values are included in a given multiple selection variable.
For example:
I have a custom variable
selectedStatuswhich values are1,2and3with an "Include All option" (not sure what to specify as a custom value for this)And a metric
status
and I want to select only those status which are selected in the selectedStatus (variable) dropdown.
For metrics
status{} 1
status{} 2
status{} 3
If I select to show status with value 1 (variable selectedStatus = 1)
I could write something like this (which works if I want to select each status independently):
status == $selectedStatus # this filters out status whose value is not equal to the selected one
Now, If I would like to select statuses which values are any of 1, 2 or 3 (selectedStatus = All), how could I write the PromQL? (something like an equivalent to an OR in SQL)