Skip to content

Commit

Permalink
Deprecate enable_tracing option (#3935)
Browse files Browse the repository at this point in the history
The option `enable_tracing` is deprecated in favor of using `traces_sample_rate`.

Fixes #3918
  • Loading branch information
antonpirker authored Jan 23, 2025
1 parent 7c757c2 commit 968b362
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime, timezone
from importlib import import_module
from typing import cast, overload
import warnings

from sentry_sdk._compat import PY37, check_uwsgi_thread_support
from sentry_sdk.utils import (
Expand Down Expand Up @@ -140,6 +141,13 @@ def _get_options(*args, **kwargs):
)
rv["socket_options"] = None

if rv["enable_tracing"] is not None:
warnings.warn(
"The `enable_tracing` parameter is deprecated. Please use `traces_sample_rate` instead.",
DeprecationWarning,
stacklevel=2,
)

return rv


Expand Down
6 changes: 6 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1490,3 +1490,9 @@ def run(self, sentry_init, capture_record_lost_event_calls):
)
def test_dropped_transaction(sentry_init, capture_record_lost_event_calls, test_config):
test_config.run(sentry_init, capture_record_lost_event_calls)


@pytest.mark.parametrize("enable_tracing", [True, False])
def test_enable_tracing_deprecated(sentry_init, enable_tracing):
with pytest.warns(DeprecationWarning):
sentry_init(enable_tracing=enable_tracing)

0 comments on commit 968b362

Please sign in to comment.