Skip to content

Commit

Permalink
Changed:Default trace propagation styles to Datadog,tracecontext
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Nov 7, 2023
1 parent 8ef4139 commit dbd9bf0
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 152 deletions.
8 changes: 4 additions & 4 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -2064,8 +2064,8 @@ 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_style` | `DD_TRACE_PROPAGATION_STYLE_EXTRACT` | `['Datadog','b3multi','b3']` | 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']` | Distributed tracing propagation formats to inject. Overrides `DD_TRACE_PROPAGATION_STYLE`. 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.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. |
Expand Down Expand Up @@ -2340,10 +2340,10 @@ Service C:
Tracing supports the following distributed trace formats:
- `Datadog`: **Default**
- `Datadog`
- `tracecontext`: [W3C Trace Context](https://www.w3.org/TR/trace-context/)
- `b3multi`: [B3 multiple-headers](https://github.com/openzipkin/b3-propagation#multiple-headers)
- `b3`: [B3 single-header](https://github.com/openzipkin/b3-propagation#single-header)
- `tracecontext`: [W3C Trace Context](https://www.w3.org/TR/trace-context/)
- `none`: No-op.
You can enable/disable the use of these formats via `Datadog.configure`:
Expand Down
8 changes: 5 additions & 3 deletions lib/datadog/tracing/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def self.extended(base)
o.default(
[
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT,
]
)
o.after_set do |styles|
Expand Down Expand Up @@ -93,7 +92,10 @@ def self.extended(base)
o.deprecated_env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT_OLD
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT
# DEV-2.0: Change default value to `tracecontext, Datadog`.
o.default [Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG]
o.default [
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT,
]
o.after_set do |styles|
# Modernize B3 options
# DEV-2.0: Can be removed with the removal of deprecated B3 constants.
Expand Down
23 changes: 9 additions & 14 deletions spec/datadog/tracing/configuration/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,9 @@
let(:var_value) { nil }

it do
is_expected.to eq(
[
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER,
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER
]
is_expected.to contain_exactly(
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT
)
end
end
Expand Down Expand Up @@ -214,27 +211,25 @@ def propagation_inject_style
it { is_expected.to eq [] }

it 'does not change propagation_extract_style' do
expect { propagation_style }.to_not change { propagation_extract_style }
.from(%w[Datadog b3multi b3])
expect { propagation_style }.to_not change { propagation_extract_style }.from(%w[Datadog tracecontext])
end

it 'does not change propagation_inject_style' do
expect { propagation_style }.to_not change { propagation_inject_style }.from(['Datadog'])
expect { propagation_style }.to_not change { propagation_inject_style }.from(%w[Datadog tracecontext])
end
end

context 'is defined' do
let(:var_value) { 'Datadog,b3' }
let(:var_value) { 'b3multi,b3' }

it { is_expected.to contain_exactly('Datadog', 'b3') }
it { is_expected.to contain_exactly('b3multi', 'b3') }

it 'sets propagation_extract_style' do
expect { propagation_style }.to change { propagation_extract_style }
.from(%w[Datadog b3multi b3]).to(%w[Datadog b3])
expect { propagation_style }.to change { propagation_extract_style }.to(%w[b3multi b3])
end

it 'sets propagation_inject_style' do
expect { propagation_style }.to change { propagation_inject_style }.from(['Datadog']).to(%w[Datadog b3])
expect { propagation_style }.to change { propagation_inject_style }.to(%w[b3multi b3])
end
end
end
Expand Down
Loading

0 comments on commit dbd9bf0

Please sign in to comment.