Search code examples
prometheus

What does buckets mean in prometheus?


I don't quiet understand what buckets mean in histogram function in prometheus What does the bucket values means in

LATENCY = Histogram('hello_world_latency_seconds',
    'Time for a request Hello World.',
    buckets=[0.0001, 0.0002, 0.0005, 0.001, 0.01, 0.1])

And

@LATENCY.time()

For example what bucket 0.0001 mean?


Solution

  • Buckets are properties of a Histogram. When you look at a viszualized Histogram, its most likeley a bar-chart.

    Every bar is a Bucket. And the value of the Bucket (height of the Bar) is the count of numbers that fit into that bucket.

    Fitting in a bucket means, a number is between either the last bucket value or 0 and the current bucket value.

    So in your example it is:

    • Bucket 1: Values between [0 and 0.0001]
    • Bucket 2: Values between ]0.0001 and 0.0002]
    • Bucket 3: Values between ]0.0002 and 0.0005] etc.