Module: ScoutApm::AutoInstrument::InstructionSequence

Defined in:
lib/scout_apm/auto_instrument/instruction_sequence.rb

Instance Method Summary collapse

Instance Method Details

#load_iseq(path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/scout_apm/auto_instrument/instruction_sequence.rb', line 7

def load_iseq(path)
  if Rails.controller_path?(path) & !Rails.ignore?(path)
    begin
      new_code = Rails.rewrite(path)
      return self.compile(new_code, File.basename(path), path)
    rescue
      warn "Failed to apply auto-instrumentation to #{path}: #{$!}"
    end
  elsif Rails.ignore?(path)
    warn "AutoInstruments are ignored for path=#{path}."
  end

  return self.compile_file(path)
end