module ScoutApm::BackgroundJobIntegrations::LegacySneakers
Constants
- UNKNOWN_QUEUE_PLACEHOLDER
Public Class Methods
Source
# File lib/scout_apm/background_job_integrations/legacy_sneakers.rb, line 20 def initialize(*args) super # Save off the existing value to call the correct existing work # function in the instrumentation. But then override Sneakers to always # use the extra-argument version, which has data Scout needs @call_work = respond_to?(:work) end
Calls superclass method
Source
# File lib/scout_apm/background_job_integrations/legacy_sneakers.rb, line 16 def self.prepended(base) ScoutApm::Agent.instance.logger.info("Prepended LegacySneakers in #{base}") end
Public Instance Methods
Source
# File lib/scout_apm/background_job_integrations/legacy_sneakers.rb, line 29 def work_with_params(msg, delivery_info, metadata) queue = delivery_info[:routing_key] || UNKNOWN_QUEUE_PLACEHOLDER job_class = self.class.name req = ScoutApm::RequestManager.lookup begin req.start_layer(ScoutApm::Layer.new('Queue', queue)) started_queue = true req.start_layer(ScoutApm::Layer.new('Job', job_class)) started_job = true if @call_work work(msg) else super end rescue Exception req.error! raise ensure req.stop_layer if started_job req.stop_layer if started_queue end end
Calls superclass method