Class: Fluent::LibratoMetricsOutput::AverageAggregator
- Inherits:
-
Object
- Object
- Fluent::LibratoMetricsOutput::AverageAggregator
- Defined in:
- lib/fluent/plugin/out_librato_metrics.rb
Overview
avg(value) aggregator
Instance Method Summary collapse
- #add(value) ⇒ Object
- #get ⇒ Object
-
#initialize ⇒ AverageAggregator
constructor
A new instance of AverageAggregator.
Constructor Details
#initialize ⇒ AverageAggregator
Returns a new instance of AverageAggregator.
167 168 169 170 |
# File 'lib/fluent/plugin/out_librato_metrics.rb', line 167 def initialize @value = 0 @num = 0 end |
Instance Method Details
#add(value) ⇒ Object
172 173 174 175 |
# File 'lib/fluent/plugin/out_librato_metrics.rb', line 172 def add(value) @value += value @num += 1 end |
#get ⇒ Object
177 178 179 |
# File 'lib/fluent/plugin/out_librato_metrics.rb', line 177 def get @value / @num end |