module ScoutApm::Instruments::ActionView::ActionViewTemplateRendererInstruments

Public Instance Methods

render_template(*args) click to toggle source

Don't forward kwargs here, since Rails 3, 4, 5, 6 don't use them, and it causes annoyances in the instrumentation

Calls superclass method
# File lib/scout_apm/instruments/action_view.rb, line 134
def render_template(*args)
  req = ScoutApm::RequestManager.lookup

  maybe_template = args[1]

  template_name = args[0].virtual_path rescue nil # Works on Rails 3.2 -> end of Rails 5 series
  template_name ||= maybe_template.virtual_path rescue nil # Works on Rails 6 -> 6.1.3
  template_name ||= "Unknown"
  layer_name = template_name + "/Rendering"

  layer = ScoutApm::Layer.new("View", layer_name)
  layer.subscopable!

  begin
    req.start_layer(layer)
    super(*args)
  ensure
    req.stop_layer
  end
end