Sha256: d2be59db0bc0b97487efa380b77937f8e846e285ea4023afa61a9d3c14ddee8f

Contents?: true

Size: 1.33 KB

Versions: 12

Compression:

Stored size: 1.33 KB

Contents

# typed: false

require_relative '../../../metadata/ext'
require_relative '../../analytics'
require_relative '../ext'
require_relative '../event'

module Datadog
  module Tracing
    module Contrib
      module ActiveJob
        module Events
          # Defines instrumentation for enqueue.active_job event
          module Enqueue
            include ActiveJob::Event

            EVENT_NAME = 'enqueue.active_job'.freeze

            module_function

            def event_name
              self::EVENT_NAME
            end

            def span_name
              Ext::SPAN_ENQUEUE
            end

            def process(span, event, _id, payload)
              span.name = span_name
              span.service = configuration[:service_name] if configuration[:service_name]
              span.resource = payload[:job].class.name
              span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_ENQUEUE)

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

              set_common_tags(span, payload)
            rescue StandardError => e
              Datadog.logger.debug(e.message)
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ddtrace-1.9.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.8.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.7.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.6.1 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.6.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.5.2 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.5.1 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.5.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.4.2 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.4.1 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.4.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb
ddtrace-1.3.0 lib/datadog/tracing/contrib/active_job/events/enqueue.rb