4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/scout_apm/instruments/resque.rb', line 4
def around_perform_with_scout_instruments(*args)
job_name = self.to_s
queue = @queue
req = ScoutApm::RequestManager.lookup
req.job!
begin
req.start_layer(ScoutApm::Layer.new('Queue', queue))
started_queue = true
req.start_layer(ScoutApm::Layer.new('Job', job_name))
started_job = true
yield
rescue => e
req.error!
raise
ensure
req.stop_layer if started_job
req.stop_layer if started_queue
end
end
|