Sha256: e3225761101aa454f4238c8d1acd86cc063c7d9d607c6e804389ac32e7e06fc7

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 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

ActiveSupport::Notifications.subscribe 'deliver.action_mailer' do |*args|
  event = ActiveSupport::Notifications::Event.new(*args)
  Traxor::Rails::ActionMailer.record(event)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
traxor-0.1.18 lib/traxor/rails/action_mailer.rb