class Prometheus::Client::Histogram::Value

Value represents the state of a Histogram at a given point.

Attributes

sum[RW]
total[RW]

Public Class Methods

new(buckets) click to toggle source
# File lib/prometheus/client/histogram.rb, line 14
def initialize(buckets)
  @sum = 0.0
  @total = 0.0

  buckets.each do |bucket|
    self[bucket] = 0.0
  end
end

Public Instance Methods

observe(value) click to toggle source
# File lib/prometheus/client/histogram.rb, line 23
def observe(value)
  @sum += value
  @total += 1

  each_key do |bucket|
    self[bucket] += 1 if value <= bucket
  end
end