Sha256: 9d18014a811fd8cd771684b69d5f83c380cf5bf351c4893a647e532dad1d0800

Contents?: true

Size: 1.28 KB

Versions: 39

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8

LibraryDetection.defer do
  @name = :rails2_error

  depends_on do
    defined?(ActionController) && defined?(ActionController::Base)
  end

  depends_on do
    defined?(::Rails) && ::Rails::VERSION::MAJOR.to_i == 2
  end

  executes do
    OneApm::Manager.logger.info 'Installing Rails 2 Error instrumentation'
  end

  executes do

    ActionController::Base.class_eval do

      # Make a note of an exception associated with the currently executing
      # controller action.  Note that this used to be available on Object
      # but we replaced that global method with OneApm::Agent#notice_error.
      # Use that one outside of controller actions.
      def oneapm_notice_error(exception, custom_params = {})
        OneApm::Transaction.notice_error exception, :custom_params => custom_params, :request => request
      end

      def rescue_action_with_oneapm_trace(exception)
        rescue_action_without_oneapm_trace exception
        OneApm::Transaction.notice_error exception, :request => request
      end

      # Compare with #alias_method_chain, which is not available in
      # Rails 1.1:
      alias_method :rescue_action_without_oneapm_trace, :rescue_action
      alias_method :rescue_action, :rescue_action_with_oneapm_trace
      protected :rescue_action

    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
oneapm_rpm-1.2.9.rc1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.8 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.8.rc1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.7 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.7.rc1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.6 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.6.rc1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.5 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.5.rc1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.4 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.4.rc1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.3 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.3.rc2 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.2 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.2.rc lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.1 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.1.rc lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.2.0 lib/one_apm/inst/rails/errors.rb
oneapm_rpm-1.1.3 lib/one_apm/inst/rails/errors.rb