Module: Datadog::OpenTelemetry::Span

Defined in:
lib/ddtrace/opentelemetry/span.rb

Overview

Extensions for Datadog::Span

Constant Summary collapse

TAG_SERVICE_NAME =
'service.name'.freeze
TAG_SERVICE_VERSION =
'service.version'.freeze

Instance Method Summary collapse

Instance Method Details

#set_tag(key, value) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ddtrace/opentelemetry/span.rb', line 10

def set_tag(key, value)
  # Configure sampling priority if they give us a forced tracing tag
  # DEV: Do not set if the value they give us is explicitly "false"
  case key
  when TAG_SERVICE_NAME
    if defined?(super)
      # Set original tag and Datadog version tag
      self.service = value
      super
    end
  when TAG_SERVICE_VERSION
    if defined?(super)
      # Set original tag and Datadog version tag
      super
      super(Datadog::Ext::Environment::TAG_VERSION, value)
    end
  else
    # Otherwise, set the tag normally.
    super if defined?(super)
  end
end