Sha256: bf688e5dd016709098ec8ec1331892b98d7f684545e277334e4d1e94f0bc5908

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

require 'ddtrace/ext/app_types'
require 'ddtrace/contrib/sidekiq/ext'

module Datadog
  module Contrib
    module Sidekiq
      # Common functionality used by both client-side and server-side tracers.
      module Tracing
        def initialize(options = {})
          @tracer = options[:tracer] || Datadog.configuration[:sidekiq][:tracer]
        end

        protected

        # If class is wrapping something else, the interesting resource info
        # is the underlying, wrapped class, and not the wrapper. This is
        # primarily to support `ActiveJob`.
        def job_resource(job)
          if job['wrapped']
            job['wrapped']
          else
            job['class']
          end
        end

        def set_service_info(service)
          # Ensure the tracer knows about this service.
          return if @tracer.services[service]
          @tracer.set_service_info(
            service,
            Ext::APP,
            Datadog::Ext::AppTypes::WORKER
          )
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ddtrace-0.22.0 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.21.2 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.21.1 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.21.0 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.20.0 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.19.1 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.19.0 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.18.3 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.18.2 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.18.1 lib/ddtrace/contrib/sidekiq/tracing.rb
ddtrace-0.18.0 lib/ddtrace/contrib/sidekiq/tracing.rb