# 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.cr

##
Constructors

- .new(name : String, help : String, buckets : Array(Float64), labels = LabelSet.new)

##
Instance Method Summary

- #collect : Array(Sample)
- #observe(value : Number)
- #type : String

### 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 #