You can directly use the count function for this:

count by(customer) (customer_alerts)

/MR

On Wed, Nov 11, 2020, 17:41 Shilpa Akhilesh <[email protected]> wrote:

> Hi,
>  am  looking for a way to count the unique label values and show each
> count for each customer name. Here are my metrics. I need to get the count
> as apple=1, orange=1.
>
>     customer_alerts(alertname="a", customername="apple")
>      customer_alerts(alertname="b", customername="orange")
>      customer_alerts(alertname="a",, customername="apple")
>
>     i tried the below query and it is showing the total count as 2, but i
> would like to show the count map to each customer name. How can I do that?
>
>     Example: apple=1, orange=1
>
>     (count(count by (alertname)(customer_alerts[24h])))
>
>     Please note I am using grafana to create the dashboard.
>
>      Thanks,
>       Shilpa
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/d91b04be-5089-4744-9f19-c5b46a621429n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/d91b04be-5089-4744-9f19-c5b46a621429n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_gZU2gU3dfkgkYWH8ExbSSBSHZ_ZjRYFFF7%2B4gXm%2B4r9dw%40mail.gmail.com.

Reply via email to