diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2019-01-07 12:40:54 +0200 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2019-01-18 17:13:09 +0200 |
commit | 3a03ba2105ce04bb5a2ff9799e7e6583b44dbf15 (patch) | |
tree | f51d196170a28384f05380c52a2f8de785b6eb8a /lib/gitlab/tracing/sidekiq/client_middleware.rb | |
parent | 33a6f23774c0e79f791da1b07dbdd48332467372 (diff) | |
download | gitlab-ce-3a03ba2105ce04bb5a2ff9799e7e6583b44dbf15.tar.gz |
Adds support for Redis and Rails tracingan/dtrace-opentracing-jaeger
Adds Redis and Rails distributed tracing support to the GitLab
application.
Diffstat (limited to 'lib/gitlab/tracing/sidekiq/client_middleware.rb')
-rw-r--r-- | lib/gitlab/tracing/sidekiq/client_middleware.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/tracing/sidekiq/client_middleware.rb b/lib/gitlab/tracing/sidekiq/client_middleware.rb new file mode 100644 index 00000000000..96d9696ed08 --- /dev/null +++ b/lib/gitlab/tracing/sidekiq/client_middleware.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'opentracing' + +module Gitlab + module Tracing + module Sidekiq + class ClientMiddleware + include SidekiqCommon + + def call(worker_class, job, queue, redis_pool) + start_active_span( + operation_name: job['class'], + tags: tags_from_job(job, 'client')) do |span| + # Inject the details directly into the job + tracer.inject(span.context, OpenTracing::FORMAT_TEXT_MAP, job) + yield + end + end + end + end + end +end |