lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb in opentelemetry-instrumentation-sidekiq-0.5.0 vs lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb in opentelemetry-instrumentation-sidekiq-0.6.0
- old
+ new
@@ -7,21 +7,23 @@
module OpenTelemetry
module Instrumentation
module Sidekiq
module Middlewares
module Client
+ # TracerMiddleware propagates context and instruments Sidekiq client
+ # by way of its middleware system
class TracerMiddleware
def call(_worker_class, job, _queue, _redis_pool)
tracer.in_span(
job['wrapped']&.to_s || job['class'],
attributes: {
'messaging.message_id' => job['jid'],
- 'messaging.destination' => job['queue'],
+ 'messaging.destination' => job['queue']
},
kind: :producer
) do |span|
OpenTelemetry.propagation.text.inject(job)
- span.add_event(name: 'created_at', timestamp: job['created_at'])
+ span.add_event('created_at', timestamp: job['created_at'])
yield
end
end
private