module ScoutApm::Instruments::ActionView::ActionViewPartialRendererInstruments

Public Instance Methods

collection_with_template(*args, **kwargs) click to toggle source
Calls superclass method
# File lib/scout_apm/instruments/action_view.rb, line 105
def collection_with_template(*args, **kwargs)
  req = ScoutApm::RequestManager.lookup

  maybe_template = args[1]

  template_name = @template.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.0.3.5
  template_name ||= "Unknown Collection"
  layer_name = template_name + "/Rendering"

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

  begin
    req.start_layer(layer)
    if ScoutApm::Agent.instance.context.environment.supports_kwarg_delegation?
      super(*args, **kwargs)
    else
      super(*args)
    end
  ensure
    req.stop_layer
  end
end
render_partial(*args, **kwargs) click to toggle source

In Rails 6, the signature changed to pass the view & template args directly, as opposed to through the instance var New signature is: def render_partial(view, template)

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

  maybe_template = args[1]

  template_name = @template.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.0.3.5
  template_name ||= "Unknown Partial"

  layer_name = template_name + "/Rendering"
  layer = ScoutApm::Layer.new("View", layer_name)
  layer.subscopable!

  begin
    req.start_layer(layer)
    if ScoutApm::Agent.instance.context.environment.supports_kwarg_delegation?
      super(*args, **kwargs)
    else
      super(*args)
    end
  ensure
    req.stop_layer
  end
end