Sha256: 8ccfa0439f08bd33871bacdee1dad303444040b7e8c8e105c577c68bce085e01

Contents?: true

Size: 892 Bytes

Versions: 38

Compression:

Stored size: 892 Bytes

Contents

# encoding: utf-8

module OneApm
  module Collector
    class Sampler

      attr_reader :id

      @sampler_classes = []

      class << self

        def named(new_name)
          @name = new_name
        end

        def name
          @name
        end

        def inherited(subclass)
          @sampler_classes << subclass
        end

        def supported_on_this_platform?
          true
        end

        def enabled?
          if @name
            config_key = "disable_#{@name}_sampler"
            !(Manager.config[config_key])
          else
            true
          end
        end

        def sampler_classes
          @sampler_classes
        end

      end

      def initialize(id = nil)
        @id = id || self.class.name
      end

      def poll
        raise "Implement in the subclass"
      end

      class Unsupported < StandardError;  end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
oneapm_rpm-1.4.2 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.4.1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.4.0 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.7 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.6 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.5 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.4 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.3 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.2 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.1.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.0 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.3.0.rc1 lib/one_apm/collector/sampler.rb
oneapm_rpm-1.2.9 lib/one_apm/collector/sampler.rb