5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/baseline_red_rpm/instruments/sidekiq.rb', line 5
def call(*args)
worker, msg, queue = args
parent_span_context = (msg)
BaselineRedRpm::Tracer.sample!(parent_span_context)
if BaselineRedRpm::Tracer.tracing?
operation = "Sidekiq_#{queue}##{msg["wrapped"]}"
span = BaselineRedRpm.tracer.start_span(operation, :child_of => parent_span_context, tags: {
"component" => "Sidekiq",
"span.kind" => "server",
"http.url" => "/sidekiq/#{queue}/#{msg['wrapped']}",
"peer.address" => Socket.gethostname,
"bg.queue" => queue,
"bg.job_name" => worker.class.to_s
})
BaselineRedRpm::Utils.log_source_and_backtrace(span, :sidekiq)
end
yield
rescue Exception => e
if span
span.set_tag('error', true)
span.log_error(e)
end
raise
ensure
span.finish if span
BaselineRedRpm::Tracer.sample_off!
end
|