29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/scout_apm/instruments/delayed_job.rb', line 29
def run_with_scout_instruments(job)
scout_method_name = method_from_handler(job.handler)
queue = job.queue
latency = (Time.now.to_f - job.created_at.to_f) * 1000
ScoutApm::Agent.instance.store.track_one!("Queue", queue, 0, {:extra_metrics => {:latency => latency}})
req = ScoutApm::RequestManager.lookup
req.job!
req.start_layer( ScoutApm::Layer.new("Job", scout_method_name) )
begin
run_without_scout_instruments(job)
rescue
req.error!
raise
ensure
req.stop_layer
end
end
|