Sha256: cafbe0e23099748e91845f476930f613b4215f9c9e9aa963a7fcb59a18621187

Contents?: true

Size: 1.33 KB

Versions: 24

Compression:

Stored size: 1.33 KB

Contents

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_at.active_job event
          module EnqueueAt
            include ActiveJob::Event

            EVENT_NAME = 'enqueue_at.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_AT)

              # 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

24 entries across 24 versions & 1 rubygems

Version Path
ddtrace-1.23.3 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.23.2 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.23.1 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.22.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.21.1 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.21.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.20.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.19.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.18.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.17.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.16.2 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.16.1 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.16.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.15.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.14.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.13.1 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.13.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.12.1 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.12.0 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb
ddtrace-1.11.1 lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb