This is a good summer of Prometheus histograms. There's a couple of thoughts I have on these.
First, 10 bins (buckets) is a small number. It only really causes a significant increase in cardinality when you use host based tags, and have hundreds of hosts. Ideally I would like several dozen bins to capture latency over a 10 second time range, at the minimum.
The other point is with cumulative histograms. They offer a nice computational advantage for calculating quantiles. Because each bucket contains the sum of the previous bin plus a delta, calculating a quantile is O(1). This isn't as important when you only have a dozen bins, but can when you get into the hundreds of bins. However, this comes at a cost. You have to send several bins for each telemetry collection request for a given value. That is amortized over larger scrape intervals though, but still comes with a small cost. There are always tradeoffs, and this is not a bad one
Yes, higher density and more efficient handling of histogram bins is something that's been on the wishlist for a while. There is currently some research going on in this area.
The Circonus log linear open source histogram is definitely the exemplar to aspire to. I followed a thread on prom dev though where it seemed that wasn't a desired direction.
1
u/[deleted] Oct 01 '19
This is a good summer of Prometheus histograms. There's a couple of thoughts I have on these.
First, 10 bins (buckets) is a small number. It only really causes a significant increase in cardinality when you use host based tags, and have hundreds of hosts. Ideally I would like several dozen bins to capture latency over a 10 second time range, at the minimum.
The other point is with cumulative histograms. They offer a nice computational advantage for calculating quantiles. Because each bucket contains the sum of the previous bin plus a delta, calculating a quantile is O(1). This isn't as important when you only have a dozen bins, but can when you get into the hundreds of bins. However, this comes at a cost. You have to send several bins for each telemetry collection request for a given value. That is amortized over larger scrape intervals though, but still comes with a small cost. There are always tradeoffs, and this is not a bad one