Skip to content

Commit

Permalink
Improve documentation for otel values
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdinur committed Jun 7, 2024
1 parent 8171e47 commit a08700a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/datadog/core/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def initialize(*_)
o.env_parser do |value|
if value
value = value.strip.downcase
# Debug is enabled when DD_TRACE_DEBUG is true or 1 OR
# when OTEL_LOG_LEVEL is set to debug
['true', '1', 'debug'].include?(value)
end
end
Expand Down Expand Up @@ -524,11 +526,12 @@ def initialize(*_)
values.each_with_object({}) do |tag, tags|
key, value = tag.split(':', 2)
if value.nil?
# tags following the Opentelemetry spec are in the format key=value
# support tags/attributes delimited by the OpenTelemetry separator (`=`)
key, value = tag.split('=', 2)
end
next if value.nil? || value.empty?

# maps OpenTelemetry semantic attributes to Datadog tags
case key.downcase
when 'deployment.environment'
tags['env'] = value
Expand Down
6 changes: 6 additions & 0 deletions lib/datadog/tracing/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ def self.extended(base)
o.type :bool
o.env_parser do |value|
value = value&.downcase
# Tracing is disabled when OTEL_TRACES_EXPORTER is none or
# DD_TRACE_ENABLED is 0 or false.
if ['none', 'false', '0'].include?(value)
false
# Tracing is enabled when DD_TRACE_ENABLED is true or 1
elsif ['true', '1'].include?(value)
true
else
Expand Down Expand Up @@ -276,6 +279,9 @@ def self.extended(base)
Datadog.logger.warn("The value '#{value}' is not yet supported. 'parentbased_#{value}' will be used instead.")
value = "parentbased_#{value}"
end
# OTEL_TRACES_SAMPLER can be set to always_on, always_off, traceidratio, and/or parentbased value.
# These values are mapped to a sample rate.
# DD_TRACE_SAMPLE_RATE sets the sample rate to float.
case value
when 'parentbased_always_on'
1.0
Expand Down

0 comments on commit a08700a

Please sign in to comment.