Module: ScoutApm::Instruments::ActionControllerRails2Instruments
- Defined in:
- lib/scout_apm/instruments/action_controller_rails_2.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.
Class Method Details
.included(instrumented_class) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/scout_apm/instruments/action_controller_rails_2.rb', line 45 def self.included(instrumented_class) ScoutApm::Agent.instance.logger.info "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.
59 60 61 62 63 64 |
# File 'lib/scout_apm/instruments/action_controller_rails_2.rb', line 59 def perform_action_with_scout_instruments(*args, &block) scout_controller_action = "Controller/#{controller_path}/#{action_name}" self.class.scout_apm_trace(scout_controller_action, :uri => request.request_uri, :ip => request.remote_ip) do perform_action_without_scout_instruments(*args, &block) end end |