Sha256: 595e8fa89d5c91ac9e3dd9bb356e0390ad845b8d4a7c76426f79b0107e506950

Contents?: true

Size: 611 Bytes

Versions: 4

Compression:

Stored size: 611 Bytes

Contents

module NewRelic::Processor
class EpochCounter<NewRelic::Plugin::Processor::Base
    def initialize
      super :epoch_counter,"Epoch Counter"
    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
      # This next line is to avoid large negative spikes during epoch reset events...
      return nil if ret.nil? or ret<0
      ret
    end
    #Component::Setup.install_processor EpochCounter
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_plugin-1.3.0 lib/newrelic_plugin/processors/epoch_counter_processor.rb
newrelic_plugin-1.2.1 lib/newrelic_plugin/processors/epoch_counter_processor.rb
newrelic_plugin-1.0.3 lib/newrelic_plugin/processors/epoch_counter_processor.rb
newrelic_plugin-1.0.2 lib/newrelic_plugin/processors/epoch_counter_processor.rb