Sha256: 231970f7934881f1daf5f7e383e247c7652edda25a92c2a660831eaf2799fca9

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require_relative '../../../metadata/ext'
require_relative '../ext'
require_relative '../event'

module Datadog
  module Tracing
    module Contrib
      module ActiveModelSerializers
        module Events
          # Defines instrumentation for render.active_model_serializers event
          module Render
            include ActiveModelSerializers::Event

            EVENT_NAME = 'render.active_model_serializers'

            module_function

            def supported?
              Gem.loaded_specs['active_model_serializers'] \
                && Gem.loaded_specs['active_model_serializers'].version >= Gem::Version.new('0.10')
            end

            def event_name
              self::EVENT_NAME
            end

            def span_name
              Ext::SPAN_RENDER
            end

            def process(span, _event, _id, payload)
              span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RENDER)

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datadog-2.1.0 lib/datadog/tracing/contrib/active_model_serializers/events/render.rb
datadog-2.0.0 lib/datadog/tracing/contrib/active_model_serializers/events/render.rb
datadog-2.0.0.beta2 lib/datadog/tracing/contrib/active_model_serializers/events/render.rb
datadog-2.0.0.beta1 lib/datadog/tracing/contrib/active_model_serializers/events/render.rb