Sha256: 2418506cb724911a853fba485fc0ba841aa4147c64e1ee2b17e910a9d02b9e59

Contents?: true

Size: 1.64 KB

Versions: 24

Compression:

Stored size: 1.64 KB

Contents

require_relative '../../../../tracing'
require_relative '../../../metadata/ext'
require_relative '../../analytics'
require_relative '../ext'
require_relative '../event'

module Datadog
  module Tracing
    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.service = configuration[:service_name] if configuration[:service_name]
              span.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
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ddtrace-1.23.3 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.23.2 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.23.1 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.22.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.21.1 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.21.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.20.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.19.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.18.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.17.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.16.2 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.16.1 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.16.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.15.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.14.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.13.1 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.13.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.12.1 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.12.0 lib/datadog/tracing/contrib/action_view/events/render_template.rb
ddtrace-1.11.1 lib/datadog/tracing/contrib/action_view/events/render_template.rb