Module: Raygun::Apm::Sidekiq::Hook
- Defined in:
- lib/raygun/apm/sidekiq/hook.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.finalize(tracer) ⇒ Object
8 9 10 |
# File 'lib/raygun/apm/sidekiq/hook.rb', line 8 def self.finalize(tracer) proc {tracer.process_ended} end |
Instance Method Details
#initialize(mgr) ⇒ Object
12 13 14 15 |
# File 'lib/raygun/apm/sidekiq/hook.rb', line 12 def initialize(mgr) super @tracer = Raygun::Apm::Tracer.instance || init_tracer end |
#process(work) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/raygun/apm/sidekiq/hook.rb', line 17 def process(work) job_hash = ::Sidekiq.load_json(work.job) queue = work.queue_name # Can be nil if we had a fatal error if @tracer @worker_started = @tracer.now @tracer.start_trace end exception = nil Ruby_APM_profiler_trace do begin super fake_http_in_handler(@tracer, @worker_started, job_hash, queue, nil) if @tracer rescue => e fake_http_in_handler(@tracer, @worker_started, job_hash, queue, e) if @tracer exception = e end end # Can be nil if we had a fatal error @tracer.end_trace if @tracer raise exception if exception rescue Raygun::Apm::FatalError => e raygun_shutdown_handler(e) end |