Sha256: 8b176f878dc0cb9135c30a23344801cbc2685d18516894cd14e13da8b8889d6a

Contents?: true

Size: 1.6 KB

Versions: 22

Compression:

Stored size: 1.6 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

DependencyDetection.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
    ::NewRelic::Agent.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 NewRelic::Agent#notice_error.
      # Use that one instead.
      #
      # @api public
      # @deprecated
      def newrelic_notice_error(exception, custom_params = {})
        NewRelic::Agent::Deprecator.deprecate("ActionController#newrelic_notice_error",
                                              "NewRelic::Agent#notice_error")

        NewRelic::Agent::Transaction.notice_error exception, :custom_params => custom_params
      end

      def rescue_action_with_newrelic_trace(exception)
        rescue_action_without_newrelic_trace exception
        NewRelic::Agent::Transaction.notice_error exception
      end

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

    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
newrelic_rpm-3.18.1.330 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.18.0.329 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.17.2.327 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.17.1.326 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.17.0.325 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.16.3.323 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.16.2.321 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.16.1.320 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.16.0.318 lib/new_relic/agent/instrumentation/rails/errors.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.15.2.317 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.15.1.316 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.15.0.314 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.14.3.313 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.14.2.312 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.14.1.311 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.14.0.305 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.13.2.302 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.13.1.300 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.13.0.299 lib/new_relic/agent/instrumentation/rails/errors.rb