Sha256: 639d3bd17c819523f1e4a3d60f4f33370779cd38037bc62d10efd1468fedfc03

Contents?: true

Size: 825 Bytes

Versions: 12

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

require "opentracing"

module Labkit
  module Middleware
    module Sidekiq
      module Tracing
        # Client provides a sidekiq client middleware for
        # instrumenting distributed tracing calls made from the client
        # application
        class Client
          include SidekiqCommon

          SPAN_KIND = "client"

          def call(_worker_class, job, _queue, _redis_pool)
            Labkit::Tracing::TracingUtils.with_tracing(operation_name: "sidekiq:#{job["class"]}", tags: tags_from_job(job, SPAN_KIND)) do |span|
              # Inject the details directly into the job
              Labkit::Tracing::TracingUtils.tracer.inject(span.context, OpenTracing::FORMAT_TEXT_MAP, job)

              yield
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gitlab-labkit-0.13.5 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.13.4 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.13.3 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.13.2 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.13.1 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.13.0 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.12.2 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.12.1 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.12.0 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.11.0 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.10.1 lib/labkit/middleware/sidekiq/tracing/client.rb
gitlab-labkit-0.10.0 lib/labkit/middleware/sidekiq/tracing/client.rb