Class: ScoutApm::Instruments::DelayedJob

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/instruments/delayed_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger = ScoutApm::Agent.instance.logger) ⇒ DelayedJob

Returns a new instance of DelayedJob.



6
7
8
9
# File 'lib/scout_apm/instruments/delayed_job.rb', line 6

def initialize(logger=ScoutApm::Agent.instance.logger)
  @logger = logger
  @installed = false
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/scout_apm/instruments/delayed_job.rb', line 4

def logger
  @logger
end

Instance Method Details

#installObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/scout_apm/instruments/delayed_job.rb', line 15

def install
  @installed = true
  if defined?(::Delayed::Worker)
    ::Delayed::Worker.class_eval do
      include ScoutApm::Tracer
      include ScoutApm::Instruments::DelayedJobInstruments
      alias run_without_scout_instruments run
      alias run run_with_scout_instruments
    end
  end
end

#installed?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/scout_apm/instruments/delayed_job.rb', line 11

def installed?
  @installed
end