aioprometheus.histogram module¶
- class aioprometheus.histogram.Histogram(*buckets: float)¶
Bases:
object
A Histogram counts individual observations from an event into configurable buckets. This histogram implementation also provides a sum and count of observations.
- observe(value: Union[float, int]) None ¶
Observe the given amount.
Observing a value into the histogram will cumulatively increment the count of observations for the buckets that the observed values falls within. It also adds the value to the sum of all observations.
- Parameters
value – A metric value to add to the histogram.
- aioprometheus.histogram.exponentialBuckets(start: Union[float, int], factor: Union[float, int], count: int) List[float] ¶
Returns buckets that are spaced exponentially.
Returns
count
buckets, where the lowest bucket has an upper bound ofstart
and each following bucket’s upper bound isfactor
times the previous bucket’s upper bound. There is no +Inf bucket is included in the returned list.- Raises
Exception if
count
is 0 or negative.- Raises
Exception if
start
is 0 or negative,- Raises
Exception if
factor
is less than or equal 1.
- aioprometheus.histogram.linearBuckets(start: Union[float, int], width: Union[int, float], count: int) List[float] ¶
Returns buckets that are spaced linearly.
Returns
count
buckets, eachwidth
wide, where the lowest bucket has an upper bound ofstart
. There is no +Inf bucket is included in the returned list.- Raises
Exception if
count
is zero or negative.