Module: ScoutRailsProxy::Instruments::ActionControllerInstruments
- Defined in:
- lib/scout_rails_proxy/instruments/rails/action_controller_instruments.rb,
lib/scout_rails_proxy/instruments/rails3/action_controller_instruments.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#perform_action_with_scout_instruments(*args, &block) ⇒ Object
In addition to instrumenting actions, this also sets the scope to the controller action name.
-
#process_action(*args) ⇒ Object
Instruments the action and tracks errors.
Class Method Details
.included(instrumented_class) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/scout_rails_proxy/instruments/rails/action_controller_instruments.rb', line 3 def self.included(instrumented_class) ScoutRailsProxy::Agent.instance.logger.debug "Instrumenting #{instrumented_class.inspect}" instrumented_class.class_eval do unless instrumented_class.method_defined?(:perform_action_without_scout_instruments) alias_method :perform_action_without_scout_instruments, :perform_action alias_method :perform_action, :perform_action_with_scout_instruments private :perform_action end end end |
Instance Method Details
#perform_action_with_scout_instruments(*args, &block) ⇒ Object
In addition to instrumenting actions, this also sets the scope to the controller action name. The scope is later applied to metrics recorded during this transaction. This lets us associate ActiveRecord calls with specific controller actions.
17 18 19 20 21 22 |
# File 'lib/scout_rails_proxy/instruments/rails/action_controller_instruments.rb', line 17 def perform_action_with_scout_instruments(*args, &block) scout_controller_action = "Controller/#{controller_path}/#{action_name}" self.class.trace(scout_controller_action, :uri => request.request_uri) do perform_action_without_scout_instruments(*args, &block) end end |
#process_action(*args) ⇒ Object
Instruments the action and tracks errors.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/scout_rails_proxy/instruments/rails3/action_controller_instruments.rb', line 5 def process_action(*args) scout_controller_action = "Controller/#{controller_path}/#{action_name}" #ScoutRailsProxy::Agent.instance.logger.debug "Processing #{scout_controller_action}" self.class.trace(scout_controller_action, :uri => request.fullpath) do begin super rescue Exception => e ScoutRailsProxy::Agent.instance.store.track!("Errors/Request",1, :scope => nil) raise ensure Thread::current[:scout_scope_name] = nil end end end |