Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One way to achieve this is through the use of the count_values function in Prometheus Query Language (PromQL). Here is an example query that counts the number of distinct values for a given label:

count_values("my_label", my_metric)

In this query, replace my_label with the name of the label you wish to count distinct values for, and my_metric with the name of the metric that contains that label.

The result of this query will be a count of the number of distinct values that exist for the specified label in the specified metric.