Module: ScoutApm::Instruments::ActionView::ActionViewTemplateRendererInstruments

Defined in:
lib/scout_apm/instruments/action_view.rb

Instance Method Summary collapse

Instance Method Details

#render_template(*args) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/scout_apm/instruments/action_view.rb', line 116

def render_template(*args)
  req = ScoutApm::RequestManager.lookup

  template_name = args[0].virtual_path rescue "Unknown"
  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