Sha256: 98415b859ed0ccffa7562f7dedfbdb2560c360793a5837fb6fde56590e0e7e9f

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require_relative 'component'
require_relative 'sidekiq/integration'
require_relative 'sidekiq/distributed/propagation'

module Datadog
  module Tracing
    module Contrib
      # `Sidekiq` integration public API
      module Sidekiq
        def self.inject(digest, data)
          raise 'Please invoke Datadog.configure at least once before calling this method' unless @propagation

          @propagation.inject!(digest, data)
        end

        def self.extract(data)
          raise 'Please invoke Datadog.configure at least once before calling this method' unless @propagation

          @propagation.extract(data)
        end

        Contrib::Component.register('sidekiq') do |config|
          tracing = config.tracing
          tracing.propagation_style # TODO: do we still need this?

          @propagation = Sidekiq::Distributed::Propagation.new(
            propagation_style_inject: tracing.propagation_style_inject,
            propagation_style_extract: tracing.propagation_style_extract,
            propagation_extract_first: tracing.propagation_extract_first
          )
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
datadog-2.9.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.8.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.7.1 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.7.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.6.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.5.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.4.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.3.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.2.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.1.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.0.0 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.0.0.beta2 lib/datadog/tracing/contrib/sidekiq.rb
datadog-2.0.0.beta1 lib/datadog/tracing/contrib/sidekiq.rb