Skip to content

Commit 3b493e1

Browse files
nellaGsentrivana
authored andcommitted
ref(celery): remove deprecated propagate_traces option
`propagate_traces` is not documented and superseded by `trace_propagation_targets`. Refs #3106
1 parent aaebe61 commit 3b493e1

File tree

5 files changed

+3
-24
lines changed

5 files changed

+3
-24
lines changed

sentry_sdk/consts.py

-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,6 @@ def __init__(
511511
debug=None, # type: Optional[bool]
512512
attach_stacktrace=False, # type: bool
513513
ca_certs=None, # type: Optional[str]
514-
propagate_traces=True, # type: bool
515514
traces_sample_rate=None, # type: Optional[float]
516515
traces_sampler=None, # type: Optional[TracesSampler]
517516
profiles_sample_rate=None, # type: Optional[float]

sentry_sdk/integrations/celery/__init__.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ class CeleryIntegration(Integration):
6262

6363
def __init__(
6464
self,
65-
propagate_traces=True,
6665
monitor_beat_tasks=False,
6766
exclude_beat_tasks=None,
6867
):
69-
# type: (bool, bool, Optional[List[str]]) -> None
70-
self.propagate_traces = propagate_traces
68+
# type: (bool, Optional[List[str]]) -> None
7169
self.monitor_beat_tasks = monitor_beat_tasks
7270
self.exclude_beat_tasks = exclude_beat_tasks
7371

@@ -254,12 +252,6 @@ def apply_async(*args, **kwargs):
254252
return f(*args, **kwargs)
255253

256254
kwarg_headers = kwargs.get("headers") or {}
257-
propagate_traces = kwarg_headers.pop(
258-
"sentry-propagate-traces", integration.propagate_traces
259-
)
260-
261-
if not propagate_traces:
262-
return f(*args, **kwargs)
263255

264256
if isinstance(args[0], Task):
265257
task_name = args[0].name # type: str

sentry_sdk/scope.py

-7
Original file line numberDiff line numberDiff line change
@@ -610,13 +610,6 @@ def iter_trace_propagation_headers(self, *args, **kwargs):
610610
If no span is given, the trace data is taken from the scope.
611611
"""
612612
client = self.get_client()
613-
if not client.options.get("propagate_traces"):
614-
warnings.warn(
615-
"The `propagate_traces` parameter is deprecated. Please use `trace_propagation_targets` instead.",
616-
DeprecationWarning,
617-
stacklevel=2,
618-
)
619-
return
620613

621614
span = kwargs.pop("span", None)
622615
span = span or self.span

tests/integrations/celery/integration_tests/test_celery_beat_cron_monitoring.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ def celery_init(sentry_init, celery_config):
3434

3535
from sentry_sdk.integrations.celery import CeleryIntegration
3636

37-
def inner(propagate_traces=True, monitor_beat_tasks=False, **kwargs):
37+
def inner(monitor_beat_tasks=False, **kwargs):
3838
sentry_init(
3939
integrations=[
4040
CeleryIntegration(
41-
propagate_traces=propagate_traces,
4241
monitor_beat_tasks=monitor_beat_tasks,
4342
)
4443
],

tests/integrations/celery/test_celery.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ def inner(signal, f):
3030
@pytest.fixture
3131
def init_celery(sentry_init, request):
3232
def inner(
33-
propagate_traces=True,
3433
backend="always_eager",
3534
monitor_beat_tasks=False,
3635
**kwargs,
3736
):
3837
sentry_init(
3938
integrations=[
4039
CeleryIntegration(
41-
propagate_traces=propagate_traces,
4240
monitor_beat_tasks=monitor_beat_tasks,
4341
)
4442
],
@@ -535,9 +533,7 @@ def test_sentry_propagate_traces_override(init_celery):
535533
Test if the `sentry-propagate-traces` header given to `apply_async`
536534
overrides the `propagate_traces` parameter in the integration constructor.
537535
"""
538-
celery = init_celery(
539-
propagate_traces=True, traces_sample_rate=1.0, release="abcdef"
540-
)
536+
celery = init_celery(traces_sample_rate=1.0, release="abcdef")
541537

542538
# Since we're applying the task inline eagerly,
543539
# we need to cleanup the otel context for this test.

0 commit comments

Comments
 (0)