Module: Datadog::Tracing::Contrib::ActionView::Events::RenderTemplate

Includes:
Datadog::Tracing::Contrib::ActionView::Event
Defined in:
lib/datadog/tracing/contrib/action_view/events/render_template.rb

Overview

Defines instrumentation for render_template.action_view event

Constant Summary collapse

EVENT_NAME =
'render_template.action_view'

Class Method Summary collapse

Methods included from Datadog::Tracing::Contrib::ActionView::Event

included

Class Method Details

.event_nameObject



22
23
24
# File 'lib/datadog/tracing/contrib/action_view/events/render_template.rb', line 22

def event_name
  self::EVENT_NAME
end

.on_start(span, _event, _id, payload) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/datadog/tracing/contrib/action_view/events/render_template.rb', line 30

def on_start(span, _event, _id, payload)
  span.service = configuration[:service_name] if configuration[:service_name]
  span.type = Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE

  span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
  span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RENDER_TEMPLATE)

  if (template_name = Utils.normalize_template_name(payload[:identifier]))
    span.resource = template_name
    span.set_tag(Ext::TAG_TEMPLATE_NAME, template_name)
  end

  layout = payload[:layout]
  span.set_tag(Ext::TAG_LAYOUT, layout) if layout

  # Measure service stats
  Contrib::Analytics.set_measured(span)

  record_exception(span, payload)
rescue StandardError => e
  Datadog.logger.debug(e.message)
end

.span_nameObject



26
27
28
# File 'lib/datadog/tracing/contrib/action_view/events/render_template.rb', line 26

def span_name
  Ext::SPAN_RENDER_TEMPLATE
end