Skip to content

Commit 968b362

Browse files
authored
Deprecate enable_tracing option (#3935)
The option `enable_tracing` is deprecated in favor of using `traces_sample_rate`. Fixes #3918
1 parent 7c757c2 commit 968b362

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

sentry_sdk/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from datetime import datetime, timezone
77
from importlib import import_module
88
from typing import cast, overload
9+
import warnings
910

1011
from sentry_sdk._compat import PY37, check_uwsgi_thread_support
1112
from sentry_sdk.utils import (
@@ -140,6 +141,13 @@ def _get_options(*args, **kwargs):
140141
)
141142
rv["socket_options"] = None
142143

144+
if rv["enable_tracing"] is not None:
145+
warnings.warn(
146+
"The `enable_tracing` parameter is deprecated. Please use `traces_sample_rate` instead.",
147+
DeprecationWarning,
148+
stacklevel=2,
149+
)
150+
143151
return rv
144152

145153

tests/test_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,3 +1490,9 @@ def run(self, sentry_init, capture_record_lost_event_calls):
14901490
)
14911491
def test_dropped_transaction(sentry_init, capture_record_lost_event_calls, test_config):
14921492
test_config.run(sentry_init, capture_record_lost_event_calls)
1493+
1494+
1495+
@pytest.mark.parametrize("enable_tracing", [True, False])
1496+
def test_enable_tracing_deprecated(sentry_init, enable_tracing):
1497+
with pytest.warns(DeprecationWarning):
1498+
sentry_init(enable_tracing=enable_tracing)

0 commit comments

Comments
 (0)