class Crometheus::Summary
- Crometheus::Summary
- Crometheus::Metric
- Reference
- Object
Overview
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
Defined in:
crometheus/summary.crClass Method Summary
-
.type
Returns
Type::Summary
. -
.valid_label?(label : Symbol)
In addition to the standard
Metric.valid_label?
behavior, returnsfalse
if a label is:quantile
.
Instance Method Summary
-
#count : Float64
The total number of observations.
-
#measure_runtime(&)
Yields to the block, then passes the block's runtime to
#observe
. - #observe(value : Number::Primitive)
- #reset
- #samples(&block : Sample -> Nil) : Nil
-
#sum : Float64
The sum of all observed values.
Instance methods inherited from class Crometheus::Metric
docstring : String
docstring,
name : Symbol
name,
samples(&block : Sample -> Nil)
samples
Constructor methods inherited from class Crometheus::Metric
new(name : Symbol, docstring : String, register_with : Crometheus::Registry | Nil = Crometheus.default_registry)
new
Class methods inherited from class Crometheus::Metric
type
type,
valid_label?(label : Symbol) : Bool
valid_label?
Class Method Detail
def self.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 Method Detail
Yields two samples, one for #count
and one for #sum
. See Metric#samples
.