Sha256: 848a91878a1a2f8913d25d91dbeaaf9d9929f0f9bcaafa1555caf318ff717641

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'ddtrace/ext/net'
require 'ddtrace/contrib/analytics'
require 'ddtrace/contrib/action_view/ext'
require 'ddtrace/contrib/action_view/event'

module Datadog
  module Contrib
    module ActionView
      module Events
        # Defines instrumentation for render_template.action_view event
        module RenderTemplate
          include ActionView::Event

          EVENT_NAME = 'render_template.action_view'.freeze

          module_function

          def event_name
            self::EVENT_NAME
          end

          def span_name
            Ext::SPAN_RENDER_TEMPLATE
          end

          def process(span, _event, _id, payload)
            span.span_type = Datadog::Ext::HTTP::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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ddtrace-0.33.1 lib/ddtrace/contrib/action_view/events/render_template.rb
ddtrace-0.33.0 lib/ddtrace/contrib/action_view/events/render_template.rb
ddtrace-0.32.0 lib/ddtrace/contrib/action_view/events/render_template.rb
ddtrace-0.31.1 lib/ddtrace/contrib/action_view/events/render_template.rb
ddtrace-0.31.0 lib/ddtrace/contrib/action_view/events/render_template.rb