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.



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

def initialize
  @value = 0
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#add(value) ⇒ Object



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

def add(value)
  @value += value
end

#modeObject



190
191
192
# File 'lib/fluent/plugin/out_metricsense.rb', line 190

def mode
  UpdateMode::ADD
end

#normalized_value(n) ⇒ Object



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

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