Class: Prometheus::Client::Summary::Value

Inherits:
Hash
  • Object
show all
Includes:
UsesValueType
Defined in:
lib/prometheus/client/summary.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UsesValueType

#value_class, #value_object

Constructor Details

#initialize(type, name, labels) ⇒ Value

Returns a new instance of Value.



16
17
18
19
# File 'lib/prometheus/client/summary.rb', line 16

def initialize(type, name, labels)
  @sum = value_object(type, name, "#{name}_sum", labels)
  @total = value_object(type, name, "#{name}_count", labels)
end

Instance Attribute Details

#sumObject

Returns the value of attribute sum.



14
15
16
# File 'lib/prometheus/client/summary.rb', line 14

def sum
  @sum
end

#totalObject

Returns the value of attribute total.



14
15
16
# File 'lib/prometheus/client/summary.rb', line 14

def total
  @total
end

Instance Method Details

#observe(value) ⇒ Object



21
22
23
24
# File 'lib/prometheus/client/summary.rb', line 21

def observe(value)
  @sum.increment(value)
  @total.increment
end