lib/prometheus/client/summary.rb in prometheus-client-0.5.0 vs lib/prometheus/client/summary.rb in prometheus-client-0.6.0
- old
+ new
@@ -6,10 +6,12 @@
module Prometheus
module Client
# Summary is an accumulator for samples. It captures Numeric data and
# provides an efficient quantile calculation mechanism.
class Summary < Metric
+ extend Gem::Deprecate
+
# Value represents the state of a Summary at a given point.
class Value < Hash
attr_accessor :sum, :total
def initialize(estimator)
@@ -25,13 +27,15 @@
def type
:summary
end
# Records a given value.
- def add(labels, value)
+ def observe(labels, value)
label_set = label_set_for(labels)
synchronize { @values[label_set].observe(value) }
end
+ alias add observe
+ deprecate :add, :observe, 2016, 10
# Returns the value for the given label set
def get(labels = {})
@validator.valid?(labels)