PromQL query to count how many series have {label=XYZ}

1,087 views
Skip to first unread message

John Dexter

unread,
Mar 24, 2021, 3:16:05 PM3/24/21
to Prometheus Users
I would like to count how many time-series have a given label value for a given metric.

I am looking at something like:
group by (job) (my_updates_total{job="Job123"})

It seems to work but feels a bit odd, is it right?

Julien Pivotto

unread,
Mar 24, 2021, 8:11:08 PM3/24/21
to John Dexter, Prometheus Users
On 24 Mar 19:15, John Dexter wrote:
> I would like to count how many time-series have a given label value for a
> given metric.
>
> I am looking at something like:
> group by (job) (my_updates_total{job="Job123"})

count by (job) (my_updates_total{job="Job123"})

>
> It seems to work but feels a bit odd, is it right?
>
> --
> 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/CAGJRanjBKf5TQNhqdV1_63%3DrfRRjoKO_XvkO-5UnErr6abQnCg%40mail.gmail.com.

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