Sha256: 9235d4268b07eef143aa9dc5286ddf28769ba16cd61ff60a265f59b35ee91185

Contents?: true

Size: 950 Bytes

Versions: 12

Compression:

Stored size: 950 Bytes

Contents

require 'dispatcher'

# NewRelic RPM instrumentation for http request dispatching (Routes mapping)
# Note, the dispatcher class from no module into into the ActionController module 
# in Rails 2.0.  Thus we need to check for both
if defined? ActionController::Dispatcher
  target = ActionController::Dispatcher
elsif defined? Dispatcher
  target = Dispatcher
else
  target = nil
end

if target
  NewRelic::Agent.instance.log.debug "Adding #{target} instrumentation"
  
  # in Rails 2.3 (Rack-based) we don't want to add instrumentation on class level
  unless defined? ::Rails::Rack
    target = target.class_eval { class << self; self; end }
  end
  
  target.class_eval do
    include NewRelic::Agent::Instrumentation::DispatcherInstrumentation

    alias_method :dispatch_without_newrelic, :dispatch
    alias_method :dispatch, :dispatch_newrelic
  end
else
  NewRelic::Agent.instance.log.debug "WARNING: Dispatcher instrumentation not added"
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
newrelic_rpm-2.8.0 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.1 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.10 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.11 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.2 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.3 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.4 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.5 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.7 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.6 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.8 lib/new_relic/agent/instrumentation/rails/dispatcher.rb
newrelic_rpm-2.8.9 lib/new_relic/agent/instrumentation/rails/dispatcher.rb