Skip to content

Commit 694b29e

Browse files
committed
fix: Gate metrics, logs user attributes behind pii
1 parent 6046f2d commit 694b29e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sentry_sdk/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ def _capture_log(self, log: "Optional[Log]") -> None:
934934
log["attributes"]["sentry.trace.parent_span_id"] = span_id
935935

936936
# The user, if present, is always set on the isolation scope.
937-
if isolation_scope._user is not None:
937+
if self.should_send_default_pii() and isolation_scope._user is not None:
938938
for log_attribute, user_attribute in (
939939
("user.id", "id"),
940940
("user.name", "username"),
@@ -998,7 +998,7 @@ def _capture_metric(self, metric: "Optional[Metric]") -> None:
998998
if span_id is not None:
999999
metric["span_id"] = span_id
10001000

1001-
if isolation_scope._user is not None:
1001+
if self.should_send_default_pii() and isolation_scope._user is not None:
10021002
for metric_attribute, user_attribute in (
10031003
("user.id", "id"),
10041004
("user.name", "username"),

0 commit comments

Comments
 (0)