Sha256: 217fabd7014a7c47c8f1aaeb128a0f3ff1c854ef623d324180809c0c7cf587b4

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module PlainApm
  module Hooks
    class ActionMailer < ActiveSupportSubscriber
      NOTIFICATION_PATTERN = /\A[^!]\w+\.action_mailer\Z/.freeze

      private

      def notification_pattern
        NOTIFICATION_PATTERN
      end

      def payload(event)
        name, source = *event.name.split(".")
        payload = event.payload

        base = {
          "source" => source,
          "name" => name,
          "backtrace" => filtered_backtrace,
          "allocations" => event.allocations,
          "started_at" => event.time,
          "finished_at" => event.end
        }

        case name
        when "deliver"
          base.merge({
            "message_id" => payload[:message_id],
            "mailer" => payload[:mailer],
            "perform_deliveries" => payload[:perform_deliveries]
          })
        when "process"
          base.merge({
            "mailer" => payload[:mailer],
            "action" => payload[:action]
          })
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plain_apm-0.4.0 lib/plain_apm/hooks/action_mailer.rb
plain_apm-0.3.0 lib/plain_apm/hooks/action_mailer.rb
plain_apm-0.2.9 lib/plain_apm/hooks/action_mailer.rb
plain_apm-0.2.8 lib/plain_apm/hooks/action_mailer.rb