class
Prometheus::Histogram
- Prometheus::Histogram
- Prometheus::Metric
- Reference
- Object
Overview
A Histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets.
Use a Histogram to track size distributions, such as:
- Request duration
- Response sizes
- Queue length variations
Example:
# Create with custom buckets
histogram = Histogram.new(
"response_time",
"Response time in seconds",
[0.1, 0.5, 1.0, 2.0, 5.0]
)
# Observe values
histogram.observe(0.25)
Histograms track:
- Count per bucket (number of values <= bucket upper bound)
- Total sum of all observed values
- Count of all observed values
Defined in:
metrics.crConstructors
Instance Method Summary
- #collect(io : IO) : Nil
- #collect : Array(Sample)
- #observe(value : Number, labels : Labels | Nil = nil)
- #type : String
Instance methods inherited from class Prometheus::Metric
collect(io : IO) : Nilcollect : Array(Sample) collect, help : String help, labels : LabelSet labels, name : String name, type : String type
Constructor methods inherited from class Prometheus::Metric
new(name : String, help : String, labels : Hash(String, String) = nil)new(name : String, help : String, labels : Prometheus::LabelSet = LabelSet.new) new