Sha256: 41711e3d1f908bd063a7c2eb85722a3bc7f3742fa7fc4b86c1477394db8f443e

Contents?: true

Size: 1.28 KB

Versions: 121

Compression:

Stored size: 1.28 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.
module NewRelic
  module Agent
    class 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
  end
end

Version data entries

121 entries across 121 versions & 6 rubygems

Version Path
wd_newrelic_rpm-3.5.8 lib/new_relic/agent/sampler.rb
sundawg_newrelic_rpm-3.5.8.2 lib/new_relic/agent/sampler.rb
sundawg_newrelic_rpm-3.5.8.1 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.8.72 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.8.70 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.8.64.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.7.59 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.7.59.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.7.58.beta lib/new_relic/agent/sampler.rb
wd_newrelic_rpm-3.5.6 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.7.57.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.6.55 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.6.48.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.6.46.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.6.42.beta lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.5.39.beta lib/new_relic/agent/sampler.rb
wd_newrelic_rpm-3.5.5 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.5.38 lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.5.540.dev lib/new_relic/agent/sampler.rb
newrelic_rpm-3.5.4.35.beta lib/new_relic/agent/sampler.rb