Sha256: 0f878f8c94e347008920deb200b2debe741179ce5108a956de1b3dcb8ade61db

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

Appsignal.logger.info("Loading Rails (#{Rails.version}) integration")

require "appsignal/rack/rails_instrumentation"

module Appsignal
  module Integrations
    # @api private
    class Railtie < ::Rails::Railtie
      initializer "appsignal.configure_rails_initialization" do |app|
        Appsignal::Integrations::Railtie.initialize_appsignal(app)
      end

      def self.initialize_appsignal(app)
        # Load config
        Appsignal.config = Appsignal::Config.new(
          Rails.root,
          Rails.env,
          :name => Rails.application.class.parent_name,
          :log_path => Rails.root.join("log")
        )

        # Start logger
        Appsignal.start_logger

        app.middleware.insert_before(
          ActionDispatch::RemoteIp,
          Appsignal::Rack::RailsInstrumentation
        )

        if Appsignal.config[:enable_frontend_error_catching]
          app.middleware.insert_before(
            Appsignal::Rack::RailsInstrumentation,
            Appsignal::Rack::JSExceptionCatcher
          )
        end

        Appsignal.start
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appsignal-2.2.0 lib/appsignal/integrations/railtie.rb
appsignal-2.2.0.beta.1 lib/appsignal/integrations/railtie.rb