summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-01-22 17:45:44 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2019-01-22 17:45:44 +0000
commitae2166188d11c6a0fef133af4b154ddf7fa83fd6 (patch)
treef7fc5d7c9a41d8e2d9c68649c8fe546ecf3ee575 /config
parentf9099b17edf86a99c0dd203ccfb8e72a0a2e25ba (diff)
parentca464b603396693ae992096a4efa05def0fa28e8 (diff)
downloadgitlab-ce-ae2166188d11c6a0fef133af4b154ddf7fa83fd6.tar.gz
Merge branch 'an-opentracing-propagation' into 'master'
Adds inter-service OpenTracing propagation See merge request gitlab-org/gitlab-ce!24239
Diffstat (limited to 'config')
-rw-r--r--config/initializers/tracing.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/config/initializers/tracing.rb b/config/initializers/tracing.rb
index be95f30d075..46e8125daf8 100644
--- a/config/initializers/tracing.rb
+++ b/config/initializers/tracing.rb
@@ -3,6 +3,26 @@
if Gitlab::Tracing.enabled?
require 'opentracing'
+ Rails.application.configure do |config|
+ config.middleware.insert_after Gitlab::Middleware::CorrelationId, ::Gitlab::Tracing::RackMiddleware
+ end
+
+ # Instrument the Sidekiq client
+ Sidekiq.configure_client do |config|
+ config.client_middleware do |chain|
+ chain.add Gitlab::Tracing::Sidekiq::ClientMiddleware
+ end
+ end
+
+ # Instrument Sidekiq server calls when running Sidekiq server
+ if Sidekiq.server?
+ Sidekiq.configure_server do |config|
+ config.server_middleware do |chain|
+ chain.add Gitlab::Tracing::Sidekiq::ServerMiddleware
+ end
+ end
+ end
+
# In multi-processed clustered architectures (puma, unicorn) don't
# start tracing until the worker processes are spawned. This works
# around issues when the opentracing implementation spawns threads