40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/scout_apm/background_job_integrations/sidekiq.rb', line 40
def call(worker, msg, queue)
msg_args = msg["args"].first
job_class = msg_args["job_class"]
latency = (Time.now.to_f - (msg['enqueued_at'] || msg['created_at'])) * 1000
ScoutApm::Agent.instance.store.track_one!("Queue", queue, 0, {:extra_metrics => {:latency => latency}})
req = ScoutApm::RequestManager.lookup
req.start_layer( ScoutApm::Layer.new("Job", job_class) )
begin
yield
rescue
req.error!
raise
ensure
req.stop_layer
end
end
|