Module: Datadog::Tracing::Contrib::ActiveModelSerializers::Event::ClassMethods

Defined in:
lib/datadog/tracing/contrib/active_model_serializers/event.rb

Overview

Class methods for ActiveModelSerializers events. Note, they share the same process method and before_trace method.

Instance Method Summary collapse

Instance Method Details

#configurationObject



26
27
28
# File 'lib/datadog/tracing/contrib/active_model_serializers/event.rb', line 26

def configuration
  Datadog.configuration.tracing[:active_model_serializers]
end

#set_common_tags(span, payload) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/datadog/tracing/contrib/active_model_serializers/event.rb', line 30

def set_common_tags(span, payload)
  span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)

  # Set analytics sample rate
  if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
    Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
  end

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

  # Set the resource name and serializer name
  res = resource(payload[:serializer])
  span.resource = res
  span.set_tag(Ext::TAG_SERIALIZER, res)

  span.type = Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE

  # Will be nil in 0.9
  span.set_tag(Ext::TAG_ADAPTER, payload[:adapter].class) unless payload[:adapter].nil?
end

#span_optionsObject



22
23
24
# File 'lib/datadog/tracing/contrib/active_model_serializers/event.rb', line 22

def span_options
  {}
end