Sha256: ca533ecc24dc68f827106f8ba80d48516d2848f49391bbf1a6f5adab88a82b53

Contents?: true

Size: 859 Bytes

Versions: 10

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

require 'airbrake/rails/event'
require 'airbrake/rails/app'

module Airbrake
  module Rails
    # ActionControllerRouteSubscriber sends route stat information, including
    # performance data.
    #
    # @since v8.0.0
    class ActionControllerRouteSubscriber
      def call(*args)
        return unless Airbrake::Config.instance.performance_stats

        # We don't track routeless events.
        return unless (routes = Airbrake::Rack::RequestStore[:routes])

        event = Airbrake::Rails::Event.new(*args)
        route = Airbrake::Rails::App.recognize_route(
          Airbrake::Rack::RequestStore[:request],
        )
        return unless route

        routes[route.path] = {
          method: event.method,
          response_type: event.response_type,
          groups: {},
        }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
airbrake-13.0.4 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-13.0.3 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-13.0.2 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-13.0.1 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-13.0.0 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-12.0.0 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-11.0.3 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-11.0.2 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-11.0.1 lib/airbrake/rails/action_controller_route_subscriber.rb
airbrake-11.0.0 lib/airbrake/rails/action_controller_route_subscriber.rb