Sha256: 890c37bec34120d771c727a029039db02babc02b40036716ced16d5e232e87b9

Contents?: true

Size: 824 Bytes

Versions: 7

Compression:

Stored size: 824 Bytes

Contents

DependencyDetection.defer do
  depends_on do
    defined?(Merb) && defined?(Merb::Dispatcher) && defined?(Merb::Dispatcher::DefaultException)
  end

  depends_on do
    Merb::Dispatcher::DefaultException.respond_to?(:before)
  end
  
  executes do
    NewRelic::Agent.logger.debug 'Installing Merb Errors instrumentation'
  end
  
  executes do

    # Hook in the notification to merb
    error_notifier = Proc.new {
      if request.exceptions #check that there's actually an exception
        # Note, this assumes we have already captured the other information such as uri and params in the MetricFrame.
        NewRelic::Agent::Instrumentation::MetricFrame.notice_error(request.exceptions.first)
      end
    }
    Merb::Dispatcher::DefaultException.before error_notifier
    Exceptions.before error_notifier

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
newrelic_rpm-3.1.2 lib/new_relic/agent/instrumentation/merb/errors.rb
newrelic_rpm-3.1.2.beta2 lib/new_relic/agent/instrumentation/merb/errors.rb
newrelic_rpm-3.1.2.beta1 lib/new_relic/agent/instrumentation/merb/errors.rb
newrelic_rpm-3.1.1 lib/new_relic/agent/instrumentation/merb/errors.rb
newrelic_rpm-3.1.1.beta3 lib/new_relic/agent/instrumentation/merb/errors.rb
newrelic_rpm-3.1.1.beta2 lib/new_relic/agent/instrumentation/merb/errors.rb
newrelic_rpm-3.1.1.beta1 lib/new_relic/agent/instrumentation/merb/errors.rb