Class: Fluent::MetricSenseOutput::AddUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_metricsense.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAddUpdater

Returns a new instance of AddUpdater.



174
175
176
# File 'lib/fluent/plugin/out_metricsense.rb', line 174

def initialize
  @value = 0
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



177
178
179
# File 'lib/fluent/plugin/out_metricsense.rb', line 177

def value
  @value
end

Instance Method Details

#add(value) ⇒ Object



183
184
185
# File 'lib/fluent/plugin/out_metricsense.rb', line 183

def add(value)
  @value += value
end

#modeObject



187
188
189
# File 'lib/fluent/plugin/out_metricsense.rb', line 187

def mode
  UpdateMode::ADD
end

#normalized_value(n) ⇒ Object



179
180
181
# File 'lib/fluent/plugin/out_metricsense.rb', line 179

def normalized_value(n)
  n == 1 ? @value : @value.to_f / n
end