Sha256: 255dbc93c73da4c75df25bd2dc3070950643b5fbedf36949519c961aee0471c4

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

# typed: false

require 'datadog/tracing/contrib/active_model_serializers/ext'
require 'datadog/tracing/contrib/active_model_serializers/event'

module Datadog
  module Tracing
    module Contrib
      module ActiveModelSerializers
        module Events
          # Defines instrumentation for !serialize.active_model_serializers event
          module Serialize
            include ActiveModelSerializers::Event

            EVENT_NAME = '!serialize.active_model_serializers'.freeze

            module_function

            def supported?
              Gem.loaded_specs['active_model_serializers'] \
                && ( \
                  Gem.loaded_specs['active_model_serializers'].version >= Gem::Version.new('0.9') \
                  && 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_SERIALIZE
            end

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

              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
ddtrace-1.2.0 lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb
ddtrace-1.1.0 lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb
ddtrace-1.0.0 lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb
ddtrace-1.0.0.beta2 lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb