Crometheus::Summary
Inherits Crometheus::Metric / Reference / Object
Summary is a metric type that keeps a running total of
observations. Every time #observe is called, sum is incremented
by the given value, and count is incremented by one.
Quantiles are not currently supported.
require "crometheus/summary"
cargo_weight = Crometheus::Summary.new(
:cargo_weight, "Weight of all boxes")
cargo_weight.observe 29.0
cargo_weight.observe 12.0
cargo_weight.observe 10.0
mean_weight = cargo_weight.sum / cargo_weight.count # => 17.0
Class methods
valid_label?(label : Symbol)
In addition to the standard Metric.valid_label? behavior,
returns false if a label is :quantile. Histograms reserve this
label for exporting quantiles (currently unsupported by
Crometheus).
Instance methods
observe(value : Int8 | Int16 | Int32 | Int64 | Int128 | Float32 | Float64)
Increments count by one and sum by value.