Sha256: e679e80ffcf51f214081be42c887e1b5af2f1aaf6e8e62fb291c72dfe6bed747

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module Datadog
  module Tracing
    module Contrib
      module DelayedJob
        module ServerInternalTracer
          # Trace when DelayedJob looks for a new job to work on
          module Worker
            def reserve_job
              configuration = Datadog.configuration.tracing[:delayed_job]

              Datadog::Tracing.trace(Ext::SPAN_RESERVE_JOB, service: configuration[:service_name]) do |span|
                span.span_type = Datadog::Tracing::Metadata::Ext::AppTypes::TYPE_WORKER

                span.set_tag(Contrib::Ext::Messaging::TAG_SYSTEM, Ext::TAG_COMPONENT)

                span.set_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
                span.set_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RESERVE_JOB)

                # Set analytics sample rate
                if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
                  Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
                end

                super
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddtrace-1.10.1 lib/datadog/tracing/contrib/delayed_job/server_internal_tracer/worker.rb
ddtrace-1.10.0 lib/datadog/tracing/contrib/delayed_job/server_internal_tracer/worker.rb