Sha256: 6baef18f8adf17a5636dee7ace5ba96ee3864742e992b784e3cb066609a47fb3

Contents?: true

Size: 1.43 KB

Versions: 9

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

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

            EVENT_NAME = 'render_partial.action_view'

            module_function

            def event_name
              self::EVENT_NAME
            end

            def span_name
              Ext::SPAN_RENDER_PARTIAL
            end

            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_PARTIAL)

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
datadog-2.9.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.8.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.7.1 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.7.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.6.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.5.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.4.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.3.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb
datadog-2.2.0 lib/datadog/tracing/contrib/action_view/events/render_partial.rb