Skip to content

Latest commit

 

History

History
137 lines (82 loc) · 3.34 KB

prometheus_buckets.md

File metadata and controls

137 lines (82 loc) · 3.34 KB

Module prometheus_buckets

Data Types


bucket_bound() = number() | infinity

buckets() = [bucket_bound(), ...]

Function Index

default/0 Default histogram buckets.
exponential/3 Creates Count buckets, where the lowest bucket has an upper bound of Start and each following bucket's upper bound is Factor times the previous bucket's upper bound.
linear/3 Creates Count buckets, each Width wide, where the lowest bucket has an upper bound of Start.
new/0
new/1 Histogram buckets constructor.
position/2

Function Details

default/0


default() -> buckets()

Default histogram buckets.

  1> prometheus_buckets:default().
  [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]

Please note these buckets are floats and represent seconds so you'll have to use prometheus_histogram:dobserve/3 or configure duration_unit as seconds.

exponential/3


exponential(Start::number(), Factor::number(), Count::pos_integer()) -> buckets()

Creates Count buckets, where the lowest bucket has an upper bound of Start and each following bucket's upper bound is Factor times the previous bucket's upper bound. The returned list is meant to be used for the buckets key of histogram constructors options.

  3> prometheus_buckets:exponential(100, 1.2, 3).
  [100, 120, 144]

The function raises {invalid_value, Value, Message} error if Count isn't positive, if Start isn't positive, or if Factor is less than or equals to 1.

linear/3


linear(Start::number(), Step::number(), Count::pos_integer()) -> buckets()

Creates Count buckets, each Width wide, where the lowest bucket has an upper bound of Start. The returned list is meant to be used for the buckets key of histogram constructors options.

  2> prometheus_buckets:linear(10, 5, 6).
  [10, 15, 20, 25, 30, 35]

The function raises {invalid_value, Value, Message} error if Count is zero or negative.

new/0

new() -> any()

new/1

new(RawBuckets) -> any()

Histogram buckets constructor

position/2

position(Buckets, Value) -> any()