lib/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware.rb in opentelemetry-instrumentation-sidekiq-0.24.3 vs lib/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware.rb in opentelemetry-instrumentation-sidekiq-0.24.4
- old
+ new
@@ -10,9 +10,11 @@
module Middlewares
module Server
# TracerMiddleware propagates context and instruments Sidekiq requests
# by way of its middleware system
class TracerMiddleware
+ include ::Sidekiq::ServerMiddleware if defined?(::Sidekiq::ServerMiddleware)
+
def call(_worker, msg, _queue)
attributes = {
SemanticConventions::Trace::MESSAGING_SYSTEM => 'sidekiq',
'messaging.sidekiq.job_class' => msg['wrapped']&.to_s || msg['class'],
SemanticConventions::Trace::MESSAGING_MESSAGE_ID => msg['jid'],