aioprometheus.histogram module¶
- class aioprometheus.histogram.Histogram(*buckets: float)¶
Bases:
objectA 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
countbuckets, where the lowest bucket has an upper bound ofstartand each following bucket’s upper bound isfactortimes the previous bucket’s upper bound. There is no +Inf bucket is included in the returned list.- Raises
Exception if
countis 0 or negative.- Raises
Exception if
startis 0 or negative,- Raises
Exception if
factoris 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
countbuckets, eachwidthwide, where the lowest bucket has an upper bound ofstart. There is no +Inf bucket is included in the returned list.- Raises
Exception if
countis zero or negative.