Sha256: 845054ec7746ca7c34c100a355e8e87c471a33cbce04d97cbdde5844ed4d2829

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

# A Sampler is used to capture meaningful metrics in a background thread 
# periodically.  They will either be invoked once a minute just before the
# data is sent to the agent (default) or every 10 seconds, when #use_harvest_sampler?
# returns false.
#
# Samplers can be added to New Relic by subclassing NewRelic::Agent::Sampler.
# Instances are created when the agent is enabled and installed.  Subclasses
# are registered for instantiation automatically.
class NewRelic::Agent::Sampler
  
  # Exception denotes a sampler is not available and it will not be registered.
  class Unsupported < StandardError;  end
  
  attr_accessor :stats_engine
  attr_reader :id
  @sampler_classes = []
  
  def self.inherited(subclass)
    @sampler_classes << subclass
  end
  
  # Override with check.  Called before instantiating.
  def self.supported_on_this_platform?
    true
  end
  
  # Override to use the periodic sampler instead of running the sampler on the
  # minute during harvests.
  def self.use_harvest_sampler?
    true
  end
  
  def self.sampler_classes
    @sampler_classes
  end
  
  def initialize(id)
    @id = id
  end
  
  def poll
    raise "Implement in the subclass"
  end
  
  
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
onyx_newrelic_rpm-2.12.5 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.13.0.beta5 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.13.0.beta4 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.13.0.beta3 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.3 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.2 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.2.beta2 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.2.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.1 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.1.alpha lib/new_relic/agent/sampler.rb
newrelic_rpm-2.12.0 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.3 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.2 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.2.beta2 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.2.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.1 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.0.beta2 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.11.0.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-2.10.8 lib/new_relic/agent/sampler.rb
newrelic_rpm-2.10.6 lib/new_relic/agent/sampler.rb