26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ddtrace/contrib/action_view/patcher.rb', line 26
def patch_renderer
if target_version >= Gem::Version.new('4.0.0')
Events.subscribe!
elsif defined?(::ActionView::TemplateRenderer) && defined?(::ActionView::PartialRenderer)
::ActionView::TemplateRenderer.send(:prepend, Instrumentation::TemplateRenderer::RailsLessThan4)
::ActionView::PartialRenderer.send(:prepend, Instrumentation::PartialRenderer::RailsLessThan4)
elsif defined?(::ActionView::Rendering) && defined?(::ActionView::Partials::PartialRenderer)
::ActionView::Rendering.send(:prepend, Instrumentation::TemplateRenderer::Rails30)
::ActionView::Partials::PartialRenderer.send(:prepend, Instrumentation::PartialRenderer::RailsLessThan4)
else
Datadog::Logger.log.debug('Expected Template/Partial classes not found; template rendering disabled')
end
end
|