From 2b5e4001a83a1d39f536798b27a8bcbb54e49da9 Mon Sep 17 00:00:00 2001 From: Alex Coomans Date: Mon, 29 Jun 2020 15:57:01 -0500 Subject: [PATCH] Ensure Sidekiq client middleware is same for clients & servers --- lib/ddtrace/contrib/sidekiq/patcher.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ddtrace/contrib/sidekiq/patcher.rb b/lib/ddtrace/contrib/sidekiq/patcher.rb index 1fec0f2abb8..efa3fd0d498 100644 --- a/lib/ddtrace/contrib/sidekiq/patcher.rb +++ b/lib/ddtrace/contrib/sidekiq/patcher.rb @@ -15,14 +15,21 @@ def target_version def patch require 'ddtrace/contrib/sidekiq/client_tracer' + require 'ddtrace/contrib/sidekiq/server_tracer' + ::Sidekiq.configure_client do |config| config.client_middleware do |chain| chain.add(Sidekiq::ClientTracer) end end - require 'ddtrace/contrib/sidekiq/server_tracer' ::Sidekiq.configure_server do |config| + # If a job enqueues another job, make sure it has the same client + # middleware. + config.client_middleware do |chain| + chain.add(Sidekiq::ClientTracer) + end + config.server_middleware do |chain| chain.add(Sidekiq::ServerTracer) end