Sha256: 37c2ea3ca34acd19f69a84797c4e4cbc55a71970398ed9f78817029c0254df17

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

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

module Datadog
  module Tracing
    module Contrib
      module ActionMailer
        module Events
          # Defines instrumentation for process.action_mailer event
          module Process
            include ActionMailer::Event

            EVENT_NAME = 'process.action_mailer'

            module_function

            def event_name
              self::EVENT_NAME
            end

            def span_name
              Ext::SPAN_PROCESS
            end

            def span_type
              # process.action_mailer processes email and renders partial templates
              Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE
            end

            def on_start(span, event, _id, payload)
              super

              span.resource = payload[:mailer] # Mailer is not available at `on_start`

              span.set_tag(Ext::TAG_ACTION, payload[:action])
              span.set_tag(Ext::TAG_MAILER, payload[:mailer])

              span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_PROCESS)
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
datadog-2.9.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.8.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.7.1 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.7.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.6.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.5.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.4.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.3.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.2.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb