themis/histogram
Types
pub type HistogramError {
MetricError(//internal)
StoreError(//internal)
InvalidBucketValue
CannotObserveNaN
LabelError(//internal)
}
Constructors
-
MetricError(//internal)
-
StoreError(//internal)
-
InvalidBucketValue
-
CannotObserveNaN
-
LabelError(//internal)
Values
pub fn new(
name name: String,
description description: String,
buckets buckets: set.Set(number.Number),
) -> Result(Nil, HistogramError)
Registers a new histogram metric to the store. The “Buckets” argument is a set of histogram buckets “le” values, as described here https://prometheus.io/docs/practices/histograms/ Will return an error if the metric name is invalid, already used, or if any of the buckets have an invalid value (“PosInf, NegInf, NaN”)
pub fn observe(
name name: String,
labels labels: dict.Dict(String, String),
value value: number.Number,
) -> Result(Nil, HistogramError)
Records a datapoint into the histogram for the given metric name. Will return an error if the name is invalid, not a registered metric or not of the correct metric type. Will return an error if any of the labels have an invalid key. Will return an error if the value is number.NaN
pub fn print() -> Result(String, HistogramError)
Formats all histogram metrics in the store as a Prometheus-compatible text string.