Class: NewRelic::Processor::Rate

Inherits:
NewRelic::Plugin::Processor::Base show all
Defined in:
lib/newrelic_plugin/processors/rate_processor.rb

Overview

OBSOLESCENCE WARNING!!!

The "Rate" processor is being obsoleted. Please do not use in any new agent development.

If you feel you need this processor, please check out the "Epoch Counter" processor and see if that will meet your needs. If not, then you can always do this calculation yourself within your agent.

This processor will be removed from the code base shortly...

Instance Attribute Summary

Attributes inherited from NewRelic::Plugin::Processor::Base

#ident, #label

Instance Method Summary collapse

Constructor Details

#initializeRate

Returns a new instance of Rate.



17
18
19
20
21
# File 'lib/newrelic_plugin/processors/rate_processor.rb', line 17

def initialize
  PlatformLogger.warn("OBSOLESCENCE WARNING: The 'Rate' processor is obsolete and should not be used.")
  PlatformLogger.warn("OBSOLESCENCE WARNING: It will be completely removed in the near future.")
  super :rate,"Rate"
end

Instance Method Details

#process(val) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/newrelic_plugin/processors/rate_processor.rb', line 22

def process val
  val=val.to_f
  ret=nil
  curr_time=Time.now
  if @last_value and @last_time and curr_time>@last_time
    ret=(val-@last_value)/(curr_time-@last_time).to_f
  end
  @last_value=val
  @last_time=curr_time
  ret
end