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.



192
193
194
# File 'lib/fluent/plugin/out_metricsense.rb', line 192

def initialize
  @value = 0
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



195
196
197
# File 'lib/fluent/plugin/out_metricsense.rb', line 195

def value
  @value
end

Instance Method Details

#add(value) ⇒ Object



201
202
203
# File 'lib/fluent/plugin/out_metricsense.rb', line 201

def add(value)
  @value += value
end

#modeObject



205
206
207
# File 'lib/fluent/plugin/out_metricsense.rb', line 205

def mode
  UpdateMode::ADD
end

#normalized_value(n) ⇒ Object



197
198
199
# File 'lib/fluent/plugin/out_metricsense.rb', line 197

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