class Instana::Activator

Attributes

activators[R]
trace_point[R]

Public Class Methods

call() click to toggle source
# File lib/instana/activator.rb, line 20
def call
  @activators ||= []
  activated, @activators = @activators.partition(&:call)
  activated
end
inherited(subclass) click to toggle source
Calls superclass method
# File lib/instana/activator.rb, line 26
def inherited(subclass)
  super(subclass)

  @activators ||= []
  @activators << subclass.new
end
start() click to toggle source
# File lib/instana/activator.rb, line 9
def start
  # :nocov:
  @trace_point = TracePoint.new(:end) do
    activated = ::Instana::Activator.call
    ::Instana.logger.debug { "Activated #{activated.join(', ')}" } unless activated.empty?
  end

  @trace_point.enable if enabled?
  # :nocov:
end

Private Class Methods

enabled?() click to toggle source
# File lib/instana/activator.rb, line 35
def enabled?
  ENV.fetch('INSTANA_DISABLE_AUTO_INSTR', 'false').eql?('false') || !ENV.key?('INSTANA_DISABLE')
end

Public Instance Methods

call() click to toggle source
# File lib/instana/activator.rb, line 40
def call
  instrument if can_instrument?
end