Class: ScoutApm::Instruments::ActionControllerRails3Rails4
- Inherits:
-
Object
- Object
- ScoutApm::Instruments::ActionControllerRails3Rails4
- Defined in:
- lib/scout_apm/instruments/action_controller_rails_3_rails4.rb
Overview
instrumentation for Rails 3 and Rails 4 is the same.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #initalize(logger = ScoutApm::Agent.instance.logger) ⇒ Object
- #install ⇒ Object
- #installed? ⇒ Boolean
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/scout_apm/instruments/action_controller_rails_3_rails4.rb', line 5 def logger @logger end |
Instance Method Details
#initalize(logger = ScoutApm::Agent.instance.logger) ⇒ Object
7 8 9 10 |
# File 'lib/scout_apm/instruments/action_controller_rails_3_rails4.rb', line 7 def initalize(logger=ScoutApm::Agent.instance.logger) @logger = logger @installed = false end |
#install ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/scout_apm/instruments/action_controller_rails_3_rails4.rb', line 16 def install @installed = true # We previously instrumented ActionController::Metal, which missed # before and after filter timing. Instrumenting Base includes those # filters, at the expense of missing out on controllers that don't use # the full Rails stack. if defined?(::ActionController) && defined?(::ActionController::Base) ScoutApm::Agent.instance.logger.info "Instrumenting ActionController::Base" ::ActionController::Base.class_eval do # include ScoutApm::Tracer include ScoutApm::Instruments::ActionControllerRails3Rails4Instruments end end if defined?(::ActionView) && defined?(::ActionView::PartialRenderer) ScoutApm::Agent.instance.logger.info "Instrumenting ActionView::PartialRenderer" ::ActionView::PartialRenderer.class_eval do include ScoutApm::Tracer instrument_method :render_partial, :type => "View", :name => '#{@template.virtual_path rescue "Unknown Partial"}/Rendering', :scope => true instrument_method :collection_with_template, :type => "View", :name => '#{@template.virtual_path rescue "Unknown Collection"}/Rendering', :scope => true end ScoutApm::Agent.instance.logger.info "Instrumenting ActionView::TemplateRenderer" ::ActionView::TemplateRenderer.class_eval do include ScoutApm::Tracer instrument_method :render_template, :type => "View", :name => '#{args[0].virtual_path rescue "Unknown"}/Rendering', :scope => true end end end |
#installed? ⇒ Boolean
12 13 14 |
# File 'lib/scout_apm/instruments/action_controller_rails_3_rails4.rb', line 12 def installed? @installed end |