Sha256: cfee0b2feb165ebe99f2a383b48203b575e5f498e6f07c1ca2e0391cdf049c15

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

# Rails 3
module ScoutRails::Instruments
  module ActionControllerInstruments
    # Instruments the action and tracks errors.
    def process_action(*args)
      scout_controller_action = "Controller/#{controller_path}/#{action_name}"
      #ScoutRails::Agent.instance.logger.debug "Processing #{scout_controller_action}"
      self.class.trace(scout_controller_action, :uri => request.fullpath) do
        begin
          super
        rescue Exception => e
          ScoutRails::Agent.instance.store.track!("Errors/Request",1, :scope => nil)
          raise
        ensure
          Thread::current[:scout_scope_name] = nil
        end
      end
    end
  end
end

# ActionController::Base is a subclass of ActionController::Metal, so this instruments both
# standard Rails requests + Metal.
if defined?(ActionController) && defined?(ActionController::Metal)
  ScoutRails::Agent.instance.logger.debug "Instrumenting ActionController::Metal"
  ActionController::Metal.class_eval do
    include ScoutRails::Tracer
    include ::ScoutRails::Instruments::ActionControllerInstruments
  end
end

if defined?(ActionView) && defined?(ActionView::PartialRenderer)
  ScoutRails::Agent.instance.logger.debug "Instrumenting ActionView::PartialRenderer"
  ActionView::PartialRenderer.class_eval do
    include ScoutRails::Tracer
    instrument_method :render_partial, :metric_name => 'View/#{@template.virtual_path}/Rendering', :scope => true
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
scout_rails-1.1.2 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.1.1 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.1.1.pre lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.1.0 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.9 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.8 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.8.pre.3 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.7 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.6 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.5 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.5.pre lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.4 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.4.pre.2 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails_proxy-1.0.4 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.4.pre lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.3 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.2 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.2.pre3 lib/scout_rails/instruments/rails3/action_controller_instruments.rb
scout_rails-1.0.2.pre2 lib/scout_rails/instruments/rails3/action_controller_instruments.rb