13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/opentelemetry/adapters/sidekiq/middlewares/server/tracer_middleware.rb', line 13
def call(_worker, msg, _queue)
parent_context = OpenTelemetry.propagation.text.(msg)
tracer.in_span(
msg['wrapped']&.to_s || msg['class'],
attributes: {
'messaging.message_id' => msg['jid'],
'messaging.destination' => msg['queue'],
},
with_parent_context: parent_context,
kind: :consumer
) do |span|
span.add_event(name: 'created_at', timestamp: msg['created_at'])
span.add_event(name: 'enqueued_at', timestamp: msg['enqueued_at'])
yield
end
end
|