Finding number of Unique Label Pairs across all time series.

37 views
Skip to first unread message

Sohaib Omar

unread,
Apr 17, 2020, 4:41:15 AM4/17/20
to Prometheus Users
Hi all, I was going through this blog : https://www.robustperception.io/how-much-ram-does-prometheus-2-x-need-for-cardinality-and-ingestion to calculate Ram capacity for our Prometheus setup. I am bit confused about how to find unique label pairs across all time-series and Avg byte per label pair. Can someone help to find the formula for unique labels across all time-series and avg byte per label?
Thanks

Julius Volz

unread,
Apr 17, 2020, 4:51:23 AM4/17/20
to Sohaib Omar, Prometheus Users
To get the total number of unique label pairs, you could get all label names via /api/v1/labels, and then for each label name, you'd have to run the query:

    count(count by(<labelname>) ({<labelname>=~".+"}))

...and then sum up all those results together.

I don't think we have a handy way of getting the average bytes per label pair, but you could again get all label names like above, and then manually process the label pairs that appear in a query like this:

    count by(<labelname>) ({<labelname>=~".+"})

You could write a small script / program that could do this via the API I guess.

On Fri, Apr 17, 2020 at 10:41 AM Sohaib Omar <soha...@gmail.com> wrote:
Hi all, I was going through this blog : https://www.robustperception.io/how-much-ram-does-prometheus-2-x-need-for-cardinality-and-ingestion to calculate Ram capacity for our Prometheus setup. I am bit confused about how to find unique label pairs across all time-series and Avg byte per label pair. Can someone help to find the formula for unique labels across all time-series and avg byte per label?
Thanks

--
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/b0141b1e-6dc0-45f8-be20-d3aa17e28753%40googlegroups.com.

Sohaib Omar

unread,
Apr 19, 2020, 11:31:55 AM4/19/20
to Julius Volz, Prometheus Users
Awesome, thanks!
Reply all
Reply to author
Forward
0 new messages