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 : 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 : Prometheus::LabelSet = LabelSet.new) new

Constructor Detail

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

Instance Method Detail

def collect : Array(Sample) #

def observe(value : Number) #

def type : String #