Class: Sqreen::Metric::Average

Inherits:
Base
  • Object
show all
Defined in:
lib/sqreen/metrics/average.rb

Overview

This perform an average aggregation

Instance Attribute Summary

Attributes inherited from Base

#name, #period, #rule

Instance Method Summary collapse

Methods inherited from Base

#initialize, #next_sample

Constructor Details

This class inherits a constructor from Sqreen::Metric::Base

Instance Method Details

#update(key, value) ⇒ Object

from class attr_accessor :aggregate



14
15
16
17
18
19
20
# File 'lib/sqreen/metrics/average.rb', line 14

def update(key, value)
  super
  @sums[key] ||= 0
  @sums[key] += value
  @counts[key] ||= 0
  @counts[key] += 1
end