Sha256: d3abf61c3c57cf05e1bb7b9429844ce9b299ea5a630fba3505515e38230e5cf8

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module NewRelic::Processor
  #
  #
  # 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...
  #
  #
  class Rate < NewRelic::Plugin::Processor::Base
    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
    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
    #Component::Setup.install_processor Rate
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_plugin-1.3.1 lib/newrelic_plugin/processors/rate_processor.rb
newrelic_plugin-1.3.0 lib/newrelic_plugin/processors/rate_processor.rb