Sha256: 20e140c240f1bdb898379a05914d24c7dc4ba879159f910ddc69e92874f4aee5

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 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 process(span, event, _id, payload)
              super

              span.type = span_type
              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

4 entries across 4 versions & 1 rubygems

Version Path
datadog-2.1.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.0.0 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.0.0.beta2 lib/datadog/tracing/contrib/action_mailer/events/process.rb
datadog-2.0.0.beta1 lib/datadog/tracing/contrib/action_mailer/events/process.rb