Sha256: 83b63a979725cb6cb8d5f1a51dd9d61079954260fde4281dcdc15c4a655457aa

Contents?: true

Size: 747 Bytes

Versions: 12

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require "opentracing"

module Labkit
  module Middleware
    module Sidekiq
      module Tracing
        # Server provides a sidekiq server middleware for
        # instrumenting distributed tracing calls when they are
        # executed by the Sidekiq server
        class Server
          include SidekiqCommon

          SPAN_KIND = "server"

          def call(_worker, job, _queue)
            context = Labkit::Tracing::TracingUtils.tracer.extract(OpenTracing::FORMAT_TEXT_MAP, job)

            Labkit::Tracing::TracingUtils.with_tracing(operation_name: "sidekiq:#{job["class"]}", child_of: context, tags: tags_from_job(job, SPAN_KIND)) { |_span| yield }
          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/server.rb
gitlab-labkit-0.13.4 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.13.3 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.13.2 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.13.1 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.13.0 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.12.2 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.12.1 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.12.0 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.11.0 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.10.1 lib/labkit/middleware/sidekiq/tracing/server.rb
gitlab-labkit-0.10.0 lib/labkit/middleware/sidekiq/tracing/server.rb