Skip to content

Commit 4d900ca

Browse files
committed
.
1 parent 0037a4a commit 4d900ca

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

sentry_sdk/integrations/wsgi.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ def __call__(
134134
)
135135
Scope.set_custom_sampling_context({"wsgi_environ": environ})
136136

137+
if should_send_default_pii():
138+
client_ip = get_client_ip(environ)
139+
if client_ip:
140+
scope.set_attribute(
141+
SPANDATA.USER_IP_ADDRESS, client_ip
142+
)
143+
137144
span_ctx = sentry_sdk.traces.start_span(
138145
name=_DEFAULT_TRANSACTION_NAME,
139146
attributes={
@@ -412,8 +419,5 @@ def _get_request_attributes(
412419
client_ip = get_client_ip(environ)
413420
if client_ip:
414421
attributes["client.address"] = client_ip
415-
sentry_sdk.get_isolation_scope().set_attribute(
416-
SPANDATA.USER_IP_ADDRESS, client_ip
417-
)
418422

419423
return attributes

0 commit comments

Comments
 (0)