View Source PromEx.BucketGenerator (PromEx v1.9.0)

This module provides functions to generate histogram bucket ranges. The lists of buckets that can be generated are either linear or exponential.

Link to this section Summary

Functions

Create an exponential set of buckets based on the provided parameters.

Create a linear set of buckets based on the provided parameters.

Link to this section Functions

Link to this function

exponential!(start, factor, num_buckets)

View Source

Specs

exponential!(start :: number(), factor :: number(), num_buckets :: number()) ::
  [
    non_neg_integer()
  ]

Create an exponential set of buckets based on the provided parameters.

examples

Examples

iex> PromEx.BucketGenerator.exponential!(1, 4, 10)
[1, 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144]

iex> PromEx.BucketGenerator.exponential!(1, 2, 10)
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
Link to this function

linear!(start, step, num_buckets)

View Source

Specs

linear!(start :: number(), step :: number(), num_buckets :: number()) :: [
  non_neg_integer()
]

Create a linear set of buckets based on the provided parameters.

examples

Examples

iex> PromEx.BucketGenerator.linear!(10, 10, 10)
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

iex> PromEx.BucketGenerator.linear!(0, 250, 11)
[0, 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500]