29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# 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 => exception
req.error!
env = {
:custom_controller => job_class,
:custom_action => queue
}
context = ScoutApm::Agent.instance.context
context.error_buffer.capture(exception, env)
raise
ensure
req.stop_layer if started_job
req.stop_layer if started_queue
end
end
|