PromQL - Possible to query label by list of values?

12 views
Skip to first unread message

Michael Black

unread,
Aug 12, 2020, 12:12:12 PM8/12/20
to Prometheus Users
Is is possible in PromQL to query a label with a list of values? For example this is a how you'd do it in SQL:

    SELECT *
    FROM my_table
    WHERE column_1 IN ('A', 'B', 'C')

Is there a similar syntax in PromQL? I would have imagined something like this:

`my_metric{Lable_1=["A", "B", "C"]}`

Julien Pivotto

unread,
Aug 12, 2020, 12:18:00 PM8/12/20
to Michael Black, Prometheus Users
Yes that is possible with a regex:

my_metric{Lable_1=~"A|B|C"}`

>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5a5448e8-f054-4ca5-8400-8eb9100a9555n%40googlegroups.com.


--
Julien Pivotto
@roidelapluie
Reply all
Reply to author
Forward
0 new messages