Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
chore: Deprecate send_default_pii
  • Loading branch information
sentrivana committed Sep 24, 2026
commit cbeed94b0811429200a1fadb72a72b5e11d81e4b
8 changes: 8 additions & 0 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
capture_internal_exceptions,
current_stacktrace,
datetime_from_isoformat,
deprecation_warning,
env_to_bool,
format_timestamp,
get_before_send_log,
Expand Down Expand Up @@ -350,6 +351,13 @@ def _get_options(*args: "Optional[str]", **kwargs: "Any") -> "Dict[str, Any]":
if rv["enable_tracing"] is True and rv["traces_sample_rate"] is None:
rv["traces_sample_rate"] = 1.0

if rv["send_default_pii"] is None:
deprecation_warning(
"The send_default_pii option is deprecated. Use data_collection "
"instead. "
"See https://docs.sentry.io/platforms/python/data-management/data-collected/"
)

rv["data_collection"] = _resolve_data_collection(rv)

# Do not add the event scrubber if data collection is enabled as it can remove data that's
Expand Down
10 changes: 10 additions & 0 deletions sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import threading
import time
import warnings
from collections import namedtuple
from contextlib import contextmanager
from datetime import datetime, timezone
Expand Down Expand Up @@ -2209,3 +2210,12 @@ def serialize_attribute(val: "AttributeValue") -> "SerializedAttributeValue":
@contextmanager
def nullcontext() -> "Iterator[None]":
yield


def deprecation_warning(msg: str) -> None:
"""
Emit a warnings.warn about a deprecation.

For other types of warnings, use logger.warning().
"""
warnings.warn(msg, stacklevel=3, category=DeprecationWarning)
6 changes: 6 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,12 @@ def test_enable_tracing_deprecated(sentry_init, enable_tracing):
sentry_init(enable_tracing=enable_tracing)


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


def test_ignore_spans_warns_without_streaming(sentry_init):
with pytest.warns(UserWarning, match=r"`ignore_spans` parameter only works"):
sentry_init(ignore_spans=["/health"], trace_lifecycle="static")
Expand Down
Loading