Skip to content

Commit

Permalink
Remove distributed_tracing option namespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Dec 15, 2023
1 parent 4dbbdb9 commit 1554aef
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 228 deletions.
12 changes: 6 additions & 6 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -2062,10 +2062,10 @@ For example, if `tracing.sampling.default_rate` is configured by [Remote Configu
| `tracing.analytics.enabled` | `DD_TRACE_ANALYTICS_ENABLED` | `nil` | Enables or disables trace analytics. See [Sampling](#sampling) for more details. |
| `tracing.contrib.peer_service_mapping` | `DD_TRACE_PEER_SERVICE_MAPPING` | `nil` | Defines remapping of `peer.service` tag across all instrumentation. Provide a list of `old_value1:new_value1, old_value2:new_value2, ...` |
| `tracing.contrib.global_default_service_name.enabled` | `DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED` | `false` | Changes the default value for `service_name` to the application service name across all instrumentation |
| `tracing.distributed_tracing.propagation_extract_first` | `DD_TRACE_PROPAGATION_EXTRACT_FIRST` | `false` | Exit immediately on the first valid propagation format detected. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.distributed_tracing.propagation_extract_style` | `DD_TRACE_PROPAGATION_STYLE_EXTRACT` | `['Datadog','tracecontext']` | Distributed tracing propagation formats to extract. Overrides `DD_TRACE_PROPAGATION_STYLE`. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.distributed_tracing.propagation_inject_style` | `DD_TRACE_PROPAGATION_STYLE_INJECT` | `['Datadog','tracecontext']` | Distributed tracing propagation formats to inject. Overrides `DD_TRACE_PROPAGATION_STYLE`. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.distributed_tracing.propagation_style` | `DD_TRACE_PROPAGATION_STYLE` | `nil` | Distributed tracing propagation formats to extract and inject. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.propagation_extract_first` | `DD_TRACE_PROPAGATION_EXTRACT_FIRST` | `false` | Exit immediately on the first valid propagation format detected. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.propagation_style_extract` | `DD_TRACE_PROPAGATION_STYLE_EXTRACT` | `['Datadog','tracecontext']` | Distributed tracing propagation formats to extract. Overrides `DD_TRACE_PROPAGATION_STYLE`. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.propagation_style_inject` | `DD_TRACE_PROPAGATION_STYLE_INJECT` | `['Datadog','tracecontext']` | Distributed tracing propagation formats to inject. Overrides `DD_TRACE_PROPAGATION_STYLE`. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.propagation_style` | `DD_TRACE_PROPAGATION_STYLE` | `nil` | Distributed tracing propagation formats to extract and inject. See [Distributed Tracing](#distributed-tracing) for more details. |
| `tracing.enabled` | `DD_TRACE_ENABLED` | `true` | Enables or disables tracing. If set to `false` instrumentation will still run, but no traces are sent to the trace agent. |
| `tracing.header_tags` | `DD_TRACE_HEADER_TAGS` | `nil` | Record HTTP headers as span tags. See [Applying header tags to root spans][header tags] for more information. |
| `tracing.instrument(<integration-name>, <options...>)` | | | Activates instrumentation for a specific library. See [Integration instrumentation](#integration-instrumentation) for more details. |
Expand Down Expand Up @@ -2350,10 +2350,10 @@ You can enable/disable the use of these formats via `Datadog.configure`:
```ruby
Datadog.configure do |c|
# List of header formats that should be extracted
c.tracing.distributed_tracing.propagation_extract_style = [ 'tracecontext', 'Datadog', 'b3' ]
c.tracing.propagation_style_extract = [ 'tracecontext', 'Datadog', 'b3' ]
# List of header formats that should be injected
c.tracing.distributed_tracing.propagation_inject_style = [ 'tracecontext', 'Datadog' ]
c.tracing.propagation_style_inject = [ 'tracecontext', 'Datadog' ]
end
```

Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/core/telemetry/collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def tracer_time
'profiling.enabled',
'runtime_metrics.enabled',
'tracing.analytics.enabled',
'tracing.distributed_tracing.propagation_inject_style',
'tracing.distributed_tracing.propagation_extract_style',
'tracing.propagation_style_inject',
'tracing.propagation_style_extract',
'tracing.enabled',
'tracing.log_injection',
'tracing.partial_flush.enabled',
Expand Down
143 changes: 66 additions & 77 deletions lib/datadog/tracing/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,95 +32,84 @@ def self.extended(base)
end
end

# [Distributed Tracing](https://docs.datadoghq.com/tracing/setup_overview/setup/ruby/#distributed-tracing) propagation
# style configuration.
# An ordered, case-insensitive list of what data propagation styles the tracer will use to extract distributed tracing propagation
# data from incoming requests and messages.
#
# The supported formats are:
# * `Datadog`: Datadog propagation format, described by [Distributed Tracing](https://docs.datadoghq.com/tracing/setup_overview/setup/ruby/#distributed-tracing).
# * `b3multi`: B3 Propagation using multiple headers, described by [openzipkin/b3-propagation](https://github.com/openzipkin/b3-propagation#multiple-headers).
# * `b3`: B3 Propagation using a single header, described by [openzipkin/b3-propagation](https://github.com/openzipkin/b3-propagation#single-header).
# The tracer will try to find distributed headers in the order they are present in the list provided to this option.
# The first format to have valid data present will be used.
#
# @public_api
settings :distributed_tracing do
# An ordered, case-insensitive list of what data propagation styles the tracer will use to extract distributed tracing propagation
# data from incoming requests and messages.
#
# The tracer will try to find distributed headers in the order they are present in the list provided to this option.
# The first format to have valid data present will be used.
#
# @default `DD_TRACE_PROPAGATION_STYLE_EXTRACT` environment variable (comma-separated list),
# otherwise `['datadog','b3multi','b3']`.
# @return [Array<String>]
option :propagation_extract_style do |o|
o.type :array
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT
o.default(
[
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT,
]
)
o.after_set do |styles|
# Make values case-insensitive
styles.map!(&:downcase)
end
end

# The case-insensitive list of the data propagation styles the tracer will use to inject distributed tracing propagation
# data into outgoing requests and messages.
#
# The tracer will inject data from all styles specified in this option.
#
# @default `DD_TRACE_PROPAGATION_STYLE_INJECT` environment variable (comma-separated list), otherwise `['datadog','tracecontext']`.
# @return [Array<String>]
option :propagation_inject_style do |o|
o.type :array
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT
o.default [
# @default `DD_TRACE_PROPAGATION_STYLE_EXTRACT` environment variable (comma-separated list),
# otherwise `['datadog','b3multi','b3']`.
# @return [Array<String>]
option :propagation_style_extract do |o|
o.type :array
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT
o.default(
[
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT,
]
o.after_set do |styles|
# Make values case-insensitive
styles.map!(&:downcase)
end
)
o.after_set do |styles|
# Make values case-insensitive
styles.map!(&:downcase)
end
end

# An ordered, case-insensitive list of what data propagation styles the tracer will use to extract distributed tracing propagation
# data from incoming requests and inject into outgoing requests.
#
# This configuration is the equivalent of configuring both {propagation_extract_style}
# {propagation_inject_style} to value set to {propagation_style}.
#
# @default `DD_TRACE_PROPAGATION_STYLE` environment variable (comma-separated list).
# @return [Array<String>]
option :propagation_style do |o|
o.type :array
o.env Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE
o.default []
o.after_set do |styles|
next if styles.empty?

# Make values case-insensitive
styles.map!(&:downcase)

set_option(:propagation_extract_style, styles)
set_option(:propagation_inject_style, styles)
end
# The case-insensitive list of the data propagation styles the tracer will use to inject distributed tracing propagation
# data into outgoing requests and messages.
#
# The tracer will inject data from all styles specified in this option.
#
# @default `DD_TRACE_PROPAGATION_STYLE_INJECT` environment variable (comma-separated list), otherwise `['datadog','tracecontext']`.
# @return [Array<String>]
option :propagation_style_inject do |o|
o.type :array
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT
o.default [
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT,
]
o.after_set do |styles|
# Make values case-insensitive
styles.map!(&:downcase)
end
end

# Strictly stop at the first successfully serialized style.
# This prevents the tracer from enriching the extracted context with information from
# other valid propagations styles present in the request.
# @default `DD_TRACE_PROPAGATION_EXTRACT_FIRST` environment variable, otherwise `false`.
# @return [Boolean]
option :propagation_extract_first do |o|
o.env Tracing::Configuration::Ext::Distributed::EXTRACT_FIRST
o.default false
o.type :bool
# An ordered, case-insensitive list of what data propagation styles the tracer will use to extract distributed tracing propagation
# data from incoming requests and inject into outgoing requests.
#
# This configuration is the equivalent of configuring both {propagation_style_extract}
# {propagation_style_inject} to value set to {propagation_style}.
#
# @default `DD_TRACE_PROPAGATION_STYLE` environment variable (comma-separated list).
# @return [Array<String>]
option :propagation_style do |o|
o.type :array
o.env Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE
o.default []
o.after_set do |styles|
next if styles.empty?

# Make values case-insensitive
styles.map!(&:downcase)

set_option(:propagation_style_extract, styles)
set_option(:propagation_style_inject, styles)
end
end

# Strictly stop at the first successfully serialized style.
# This prevents the tracer from enriching the extracted context with information from
# other valid propagations styles present in the request.
# @default `DD_TRACE_PROPAGATION_EXTRACT_FIRST` environment variable, otherwise `false`.
# @return [Boolean]
option :propagation_extract_first do |o|
o.env Tracing::Configuration::Ext::Distributed::EXTRACT_FIRST
o.default false
o.type :bool
end

# Enable trace collection and span generation.
#
# You can use this option to disable tracing without having to
Expand Down
Loading

0 comments on commit 1554aef

Please sign in to comment.