Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(propagation): remove b3 single header #12167

Merged
merged 8 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ddtrace/propagation/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def _extract(headers):


class _B3SingleHeader:
"""Helper class to inject/extract B3 Single Header
"""Helper class to inject/extract B3

https://github.com/openzipkin/b3-propagation/blob/3e54cda11620a773d53c7f64d2ebb10d3a01794c/README.md#single-header

Expand Down
10 changes: 0 additions & 10 deletions ddtrace/settings/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from ..internal.constants import DEFAULT_SAMPLING_RATE_LIMIT
from ..internal.constants import DEFAULT_TIMEOUT
from ..internal.constants import PROPAGATION_STYLE_ALL
from ..internal.constants import PROPAGATION_STYLE_B3_SINGLE
mabdinur marked this conversation as resolved.
Show resolved Hide resolved
from ..internal.logger import get_logger
from ..internal.schema import DEFAULT_SPAN_SERVICE_NAME
from ..internal.serverless import in_aws_lambda
Expand Down Expand Up @@ -116,7 +115,6 @@ def _parse_propagation_styles(styles_str):
- "datadog"
- "b3multi"
- "b3" (formerly 'b3 single header')
- "b3 single header (deprecated for 'b3')"
- "tracecontext"
- "baggage"
- "none"
Expand All @@ -142,14 +140,6 @@ def _parse_propagation_styles(styles_str):
styles = []
for style in styles_str.split(","):
style = style.strip().lower()
if style == "b3 single header":
deprecate(
'Using DD_TRACE_PROPAGATION_STYLE="b3 single header" is deprecated',
message="Please use 'DD_TRACE_PROPAGATION_STYLE=\"b3\"' instead",
removal_version="3.0.0",
category=DDTraceDeprecationWarning,
)
style = PROPAGATION_STYLE_B3_SINGLE
# None has no propagator so we pull it out
if not style or style == _PROPAGATION_STYLE_NONE:
continue
Expand Down
6 changes: 3 additions & 3 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Traces

Overridden by ``DD_TRACE_PROPAGATION_STYLE_INJECT`` for injection.

The supported values are ``datadog``, ``b3multi``, and ``b3 single header``, ``tracecontext``, and ``none``.
The supported values are ``datadog``, ``b3multi``, ``tracecontext``, and ``none``.

When checking inbound request headers we will take the first valid trace context in the order provided.
When ``none`` is the only propagator listed, propagation is disabled.
Expand Down Expand Up @@ -357,7 +357,7 @@ Trace Context propagation

Overrides ``DD_TRACE_PROPAGATION_STYLE`` for extraction propagation style.

The supported values are ``datadog``, ``b3multi``, and ``b3 single header``, ``tracecontext``, and ``none``.
The supported values are ``datadog``, ``b3multi``, ``b3``, ``tracecontext``, and ``none``.

When checking inbound request headers we will take the first valid trace context in the order provided.
When ``none`` is the only propagator listed, extraction is disabled.
Expand Down Expand Up @@ -397,7 +397,7 @@ Trace Context propagation

Overrides ``DD_TRACE_PROPAGATION_STYLE`` for injection propagation style.

The supported values are ``datadog``, ``b3multi``, and ``b3 single header``, ``tracecontext``, and ``none``.
The supported values are ``datadog``, ``b3multi``,``b3``, ``tracecontext``, and ``none``.

All provided styles are injected into the headers of outbound requests.
When ``none`` is the only propagator listed, injection is disabled.
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/remove-b3-single--4c16c32466c69709.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
upgrade:
- |
propagation: Setting ``DD_TRACE_PROPAGATION_STYLE`` to ``b3 single header`` is no longer supported. Use ``b3`` instead.
9 changes: 0 additions & 9 deletions tests/tracer/test_global_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os
from unittest import TestCase

import mock
import pytest

from ddtrace import config as global_config
from ddtrace.settings import Config
from ddtrace.settings._config import _parse_propagation_styles

from ..utils import DummyTracer
from ..utils import override_env
Expand Down Expand Up @@ -282,10 +280,3 @@ def test_dd_service_mapping(self):
with override_env(dict(DD_SERVICE_MAPPING="foobar:bar,snafu:foo")):
c = Config()
assert c.service_mapping == {"foobar": "bar", "snafu": "foo"}

def test_parse_propagation_styles_b3_deprecation(capsys):
with pytest.warns(
DeprecationWarning, match='Using DD_TRACE_PROPAGATION_STYLE="b3 single header" is deprecated'
), override_env(dict(DD_TRACE_PROPAGATION_STYLE="b3 single header")):
style = _parse_propagation_styles(os.environ["DD_TRACE_PROPAGATION_STYLE"])
assert style == ["b3"]
6 changes: 3 additions & 3 deletions tests/tracer/test_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ def test_extract_tracecontext(headers, expected_context):
"dd_origin": None,
},
),
# B3 single header
# B3
(
"valid_b3_single_header_simple",
[PROPAGATION_STYLE_B3_SINGLE],
Expand Down Expand Up @@ -2639,7 +2639,7 @@ def test_DD_TRACE_PROPAGATION_STYLE_EXTRACT_overrides_DD_TRACE_PROPAGATION_STYLE
),
),
# The trace_id from Datadog context will not align with the tracecontext primary context
# therefore we get a span link. B3 single headers are invalid so we won't see a trace of them.
# therefore we get a span link. B3 is invalid so we won't see a trace of them.
# The b3 multi headers are missing a span_id, so we will skip creating a span link for it.
(
"all_headers_all_styles_do_not_create_span_link_for_context_w_out_span_id",
Expand Down Expand Up @@ -2994,7 +2994,7 @@ def test_span_links_set_on_root_span_not_child(fastapi_client, tracer, fastapi_t
_HTTP_HEADER_B3_SPAN_ID: "7197677932a62370",
},
),
# B3 Single Header
# B3
(
"valid_b3_single_style",
[PROPAGATION_STYLE_B3_SINGLE],
Expand Down
Loading