Module: Datadog::Tracing::Contrib::ActiveModelSerializers::Events::Serialize

Includes:
Datadog::Tracing::Contrib::ActiveModelSerializers::Event
Defined in:
lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb

Overview

Defines instrumentation for !serialize.active_model_serializers event

Constant Summary collapse

EVENT_NAME =
'!serialize.active_model_serializers'

Class Method Summary collapse

Methods included from Datadog::Tracing::Contrib::ActiveModelSerializers::Event

included

Class Method Details

.event_nameObject



27
28
29
# File 'lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb', line 27

def event_name
  self::EVENT_NAME
end

.on_start(span, _event, _id, payload) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb', line 35

def on_start(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

.span_nameObject



31
32
33
# File 'lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb', line 31

def span_name
  Ext::SPAN_SERIALIZE
end

.supported?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb', line 19

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