Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 2 additions & 8 deletions sentry_sdk/integrations/rust_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import sentry_sdk
from sentry_sdk.integrations import Integration
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.utils import SENSITIVE_DATA_SUBSTITUTE

if TYPE_CHECKING:
Expand Down Expand Up @@ -161,14 +160,9 @@ def _include_tracing_fields(self) -> bool:
"""
By default, the values of tracing fields are not included in case they
contain PII. A user may override that by passing `True` for the
`include_tracing_fields` keyword argument of this integration or by
setting `send_default_pii` to `True` in their Sentry client options.
`include_tracing_fields` keyword argument of this integration.
"""
return (
should_send_default_pii()
if self.include_tracing_fields is None
else self.include_tracing_fields
)
return bool(self.include_tracing_fields)

def on_event(self, event: str, sentry_span: "Span") -> None:
deserialized_event = json.loads(event)
Expand Down
17 changes: 5 additions & 12 deletions tests/integrations/rust_tracing/test_rust_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,21 +463,15 @@ def span_filter(metadata: Dict[str, object]) -> bool:


@pytest.mark.parametrize(
"send_default_pii, include_tracing_fields, tracing_fields_expected",
"include_tracing_fields, tracing_fields_expected",
[
(True, True, True),
(True, False, False),
(True, None, True),
(False, True, True),
(False, False, False),
(False, None, False),
(True, True),
(False, False),
(None, False),
],
)
def test_include_tracing_fields(
sentry_init,
send_default_pii,
include_tracing_fields,
tracing_fields_expected,
sentry_init, include_tracing_fields, tracing_fields_expected
):
rust_tracing = FakeRustTracing()
integration = RustTracingIntegration(
Expand All @@ -489,7 +483,6 @@ def test_include_tracing_fields(
sentry_init(
integrations=[integration],
traces_sample_rate=1.0,
send_default_pii=send_default_pii,
)
with sentry_sdk.start_span(name="custom parent"):
rust_tracing.new_span(RustTracingLevel.Info, 3)
Expand Down
Loading