Sha256: 596e17be0febdf7df93b071569f258c60e05e41c2d835d9d4c91a2fdb189d90e
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
# encoding: utf-8 LibraryDetection.defer do @name = :delayed_job depends_on do !OneApm::Agent.config[:disable_dj] end depends_on do defined?(::Delayed) && defined?(::Delayed::Worker) && !OneApm::Agent.config[:disable_dj] end executes do ::OneApm::Agent.logger.info 'Installing DelayedJob instrumentation [part 1/2]' end executes do Delayed::Worker.class_eval do def initialize_with_one_apm(*args) initialize_without_one_apm(*args) worker_name = case when self.respond_to?(:name) then self.name when self.class.respond_to?(:default_name) then self.class.default_name end OneApm::DelayedJobInjection.worker_name = worker_name if defined?(::Delayed::Job) && ::Delayed::Job.method_defined?(:invoke_job) ::OneApm::Agent.logger.info 'Installing DelayedJob instrumentation [part 2/2]' install_oneapm_job_tracer OneApm::Probe.instance.init_plugin :dispatcher => :delayed_job else OneApm::Agent.logger.warn("Did not find a Delayed::Job class responding to invoke_job, aborting DJ instrumentation") end end alias initialize_without_one_apm initialize alias initialize initialize_with_one_apm def install_oneapm_job_tracer Delayed::Job.class_eval do include OneApm::Agent::Instrumentation::TransactionBase if self.instance_methods.include?('name') || self.instance_methods.include?(:name) add_transaction_tracer "invoke_job", :category => 'OtherTransaction/DelayedJob', :path => '#{self.name}' else add_transaction_tracer "invoke_job", :category => 'OtherTransaction/DelayedJob' end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oneapm_rpm-1.1.1 | lib/one_apm/inst/background_job/delayed_job.rb |
oneapm_rpm-1.1.0 | lib/one_apm/inst/background_job/delayed_job.rb |