Sha256: e0bf7b6bc5826fefa4d76a80143c196fb59a6e6831a8a40e7c5d7bac8b88801d

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 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_partial.action_view event
        module RenderPartial
          include ActionView::Event

          EVENT_NAME = 'render_partial.action_view'.freeze

          module_function

          def event_name
            self::EVENT_NAME
          end

          def span_name
            Ext::SPAN_RENDER_PARTIAL
          end

          def process(span, _event, _id, payload)
            span.span_type = Datadog::Ext::HTTP::TEMPLATE

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddtrace-0.30.1 lib/ddtrace/contrib/action_view/events/render_partial.rb
ddtrace-0.30.0 lib/ddtrace/contrib/action_view/events/render_partial.rb