Sha256: d6ba48e0b83873414ae50781b2844920f0f95533b01a68141b69fc865795d625

Contents?: true

Size: 1.02 KB

Versions: 14

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

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

      private

      def notification_pattern
        NOTIFICATION_PATTERN
      end

      def payload(event)
        name, base = attributes_from_notification(event)
        payload = event.payload

        case name
        when "process_action"
          base.merge({
            "controller" => payload[:controller],
            "action" => payload[:action],
            "params" => payload[:params],
            "format" => payload[:format],
            "method" => payload[:method],
            "path" => payload[:path],
            "status" => payload[:status]
          })
        when "redirect_to", "start_processing", "halted_callback", "send_file", "send_data"
          nil
        when "read_fragment", "write_fragment", "exist_fragment?", "expire_fragment"
          # controller, action, key
          nil
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
plain_apm-0.9.2 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.9.1 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.9.0 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.8 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.7 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.6 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.5 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.4 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.3 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.2 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.1 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.8.0 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.7.1 lib/plain_apm/hooks/action_pack.rb
plain_apm-0.7.0 lib/plain_apm/hooks/action_pack.rb