Sha256: 3153ed7c72b42dc9f2a6726d062b38cb0643df2d70f80f759c5c8765ea73cf9a

Contents?: true

Size: 1.11 KB

Versions: 46

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

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_after(
          ActionDispatch::DebugExceptions,
          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

46 entries across 46 versions & 1 rubygems

Version Path
appsignal-2.8.4 lib/appsignal/integrations/railtie.rb
appsignal-2.8.4-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.4.beta.1 lib/appsignal/integrations/railtie.rb
appsignal-2.8.4.beta.1-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.3 lib/appsignal/integrations/railtie.rb
appsignal-2.8.3-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.3.beta.1 lib/appsignal/integrations/railtie.rb
appsignal-2.8.3.beta.1-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.2 lib/appsignal/integrations/railtie.rb
appsignal-2.8.2-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.1 lib/appsignal/integrations/railtie.rb
appsignal-2.8.1-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.1.alpha.1-java lib/appsignal/integrations/railtie.rb
appsignal-2.8.1.alpha.1 lib/appsignal/integrations/railtie.rb
appsignal-2.8.0 lib/appsignal/integrations/railtie.rb
appsignal-2.8.0-java lib/appsignal/integrations/railtie.rb
appsignal-2.7.3.beta.2-java lib/appsignal/integrations/railtie.rb
appsignal-2.7.3.beta.2 lib/appsignal/integrations/railtie.rb
appsignal-2.7.3.beta.1 lib/appsignal/integrations/railtie.rb
appsignal-2.7.3.beta.1-java lib/appsignal/integrations/railtie.rb