Sha256: b4b5430a0deb40e474fc84f8b29ad5578bc32e444768272c875e0561ed98ee1b

Contents?: true

Size: 1.34 KB

Versions: 19

Compression:

Stored size: 1.34 KB

Contents

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 outside of controller actions.
      def newrelic_notice_error(exception, custom_params = {})
        NewRelic::Agent::Instrumentation::MetricFrame.notice_error exception, :custom_params => custom_params, :request => request
      end

      def rescue_action_with_newrelic_trace(exception)
        rescue_action_without_newrelic_trace exception
        NewRelic::Agent::Instrumentation::MetricFrame.notice_error exception, :request => request
      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

19 entries across 19 versions & 3 rubygems

Version Path
wd_newrelic_rpm-3.5.8 lib/new_relic/agent/instrumentation/rails/errors.rb
sundawg_newrelic_rpm-3.5.8.2 lib/new_relic/agent/instrumentation/rails/errors.rb
sundawg_newrelic_rpm-3.5.8.1 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.8.72 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.8.70 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.8.64.beta lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.7.59 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.7.59.beta lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.7.58.beta lib/new_relic/agent/instrumentation/rails/errors.rb
wd_newrelic_rpm-3.5.6 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.7.57.beta lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.6.55 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.6.48.beta lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.6.46.beta lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.6.42.beta lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.5.39.beta lib/new_relic/agent/instrumentation/rails/errors.rb
wd_newrelic_rpm-3.5.5 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.5.38 lib/new_relic/agent/instrumentation/rails/errors.rb
newrelic_rpm-3.5.5.540.dev lib/new_relic/agent/instrumentation/rails/errors.rb