class Prometheus::Histogram

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:

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:

Defined in:

metrics.cr

Constructors

Instance Method Summary

Instance methods inherited from class Prometheus::Metric

collect(io : IO) : Nil
collect : 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

Constructor Detail

def self.new(name : String, help : String, buckets : Array(Float64), labels = Labels.new) #

Instance Method Detail

def collect(io : IO) : Nil #

def collect : Array(Sample) #

def observe(value : Number, labels : Labels | Nil = nil) #

def type : String #