Class: Prometheus::Client::Summary
- Defined in:
- lib/prometheus/client/summary.rb
Overview
Summary is an accumulator for samples. It captures Numeric data and provides an efficient quantile calculation mechanism.
Defined Under Namespace
Classes: Value
Instance Attribute Summary
Attributes inherited from Metric
#base_labels, #docstring, #name
Instance Method Summary collapse
-
#add(labels, value) ⇒ Object
Records a given value.
-
#get(labels = {}) ⇒ Object
Returns the value for the given label set.
- #type ⇒ Object
-
#values ⇒ Object
Returns all label sets with their values.
Methods inherited from Metric
Constructor Details
This class inherits a constructor from Prometheus::Client::Metric
Instance Method Details
#add(labels, value) ⇒ Object
Records a given value.
30 31 32 33 |
# File 'lib/prometheus/client/summary.rb', line 30 def add(labels, value) label_set = label_set_for(labels) synchronize { @values[label_set].observe(value) } end |
#get(labels = {}) ⇒ Object
Returns the value for the given label set
36 37 38 39 40 41 42 |
# File 'lib/prometheus/client/summary.rb', line 36 def get(labels = {}) @validator.valid?(labels) synchronize do Value.new(@values[labels]) end end |
#type ⇒ Object
25 26 27 |
# File 'lib/prometheus/client/summary.rb', line 25 def type :summary end |