r/PrometheusMonitoring • • Sep 30 '19

How does a Prometheus Histogram work?

https://www.robustperception.io/how-does-a-prometheus-histogram-work
9 Upvotes

3 comments sorted by

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

1

u/SuperQue Oct 05 '19

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.

1

u/[deleted] Oct 07 '19

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.