Sha256: 9dcd047c5da4ddd5e360b1cbaf69060cceac583067605284ddddcaf363e9dd39

Contents?: true

Size: 600 Bytes

Versions: 3

Compression:

Stored size: 600 Bytes

Contents

# frozen_string_literal: true

require 'active_support/notifications'

module Traxor
  module Rails
    module ActionMailer
      COUNT_METRIC = 'rails.action_mailer.sent.count'

      def self.record(event)
        tags = { action_mailer_class_name: event.payload[:mailer] }
        Metric.count COUNT_METRIC, 1, tags
      end
    end
  end
end

if Traxor.enabled? && Traxor.scopes.include?(:action_mailer)
  ActiveSupport::Notifications.subscribe 'deliver.action_mailer' do |*args|
    event = ActiveSupport::Notifications::Event.new(*args)
    Traxor::Rails::ActionMailer.record(event)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
traxor-0.2.0 lib/traxor/rails/action_mailer.rb
traxor-0.1.20 lib/traxor/rails/action_mailer.rb
traxor-0.1.19 lib/traxor/rails/action_mailer.rb