From f9ea766f22e3b99cdc2fe0f00259ed95e951a4b6 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 30 Jul 2026 09:53:03 +0200 Subject: [PATCH] ref: Remove `propagate_traces` --- MIGRATION_GUIDE.md | 1 + sentry_sdk/consts.py | 3 --- sentry_sdk/scope.py | 7 ------- tests/tracing/test_integration_tests.py | 14 -------------- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index ab89d158df..c97aef6b8d 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -32,6 +32,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh - Removed the `auto_session_tracing` decorator. Use `track_session` instead. - The deprecated `set_measurement` API was removed. - The experimental option `otel_powered_performance` has been removed together with the associated `OpenTelemetryIntegration` and `opentelemetry-experimental` extra. +- The deprecated `propagate_traces` option has been removed. Use `trace_propagation_targets` instead, which gives you more power over trace propagation. Note that only the top-level `init` option was removed; the `propagate_traces` option of the Celery integration remains available. ## Deprecated diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index c2500ca913..2ebba211b7 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1291,7 +1291,6 @@ def __init__( debug: "Optional[bool]" = None, attach_stacktrace: bool = False, ca_certs: "Optional[str]" = None, - propagate_traces: bool = True, traces_sample_rate: "Optional[float]" = None, trace_lifecycle: "Optional[Literal['static', 'stream']]" = None, traces_sampler: "Optional[TracesSampler]" = None, @@ -1704,8 +1703,6 @@ def __init__( :param enable_tracing: - :param propagate_traces: - :param auto_session_tracking: :param spotlight: diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index d1be9f53db..4ac12e9310 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -683,13 +683,6 @@ def iter_trace_propagation_headers( If no span is given, the trace data is taken from the scope. """ client = self.get_client() - if not client.options.get("propagate_traces"): - warnings.warn( - "The `propagate_traces` parameter is deprecated. Please use `trace_propagation_targets` instead.", - DeprecationWarning, - stacklevel=2, - ) - return span = kwargs.pop("span", None) if not span: diff --git a/tests/tracing/test_integration_tests.py b/tests/tracing/test_integration_tests.py index a7d59d2741..a363a64982 100644 --- a/tests/tracing/test_integration_tests.py +++ b/tests/tracing/test_integration_tests.py @@ -313,20 +313,6 @@ def test_continue_trace_span_streaming( assert message_payload["message"] == "hello" -@pytest.mark.parametrize("sample_rate", [0.0, 1.0]) -def test_propagate_traces_deprecation_warning(sentry_init, sample_rate): - sentry_init(traces_sample_rate=sample_rate, propagate_traces=False) - - with start_transaction(name="hi"): - with start_span() as old_span: - with pytest.warns(DeprecationWarning): - dict( - sentry_sdk.get_current_scope().iter_trace_propagation_headers( - old_span - ) - ) - - @pytest.mark.parametrize("sample_rate", [0.5, 1.0]) def test_dynamic_sampling_head_sdk_creates_dsc( sentry_init, capture_envelopes, sample_rate, monkeypatch