Module: Datadog::Contrib::ActionView::Instrumentation::PartialRenderer

Included in:
Rails6Plus, RailsLessThan6
Defined in:
lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb

Overview

Instrumentation for partial rendering

Defined Under Namespace

Modules: Rails6Plus, RailsLessThan6

Instance Method Summary collapse

Instance Method Details

#datadog_render_partial(template) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb', line 31

def datadog_render_partial(template)
  template_name = Utils.normalize_template_name(template.try('identifier'))

  if template_name
    active_datadog_span.set_tag(
      Ext::TAG_TEMPLATE_NAME,
      template_name
    )
  end
end

#render(*args, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb', line 9

def render(*args, &block)
  datadog_tracer.trace(
    Ext::SPAN_RENDER_PARTIAL,
    span_type: Datadog::Ext::HTTP::TEMPLATE
  ) do |span|
    with_datadog_span(span) { super(*args) }
  end
end

#render_partial(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb', line 18

def render_partial(*args)
  begin
    template = datadog_template(*args)

    datadog_render_partial(template)
  rescue StandardError => e
    Datadog::Tracer.log.debug(e.message)
  end

  # execute the original function anyway
  super(*args)
end