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
8 changes: 2 additions & 6 deletions sentry_sdk/integrations/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sentry_sdk.integrations._wsgi_common import (
DEFAULT_HTTP_METHODS_TO_CAPTURE,
)
from sentry_sdk.scope import Scope, should_send_default_pii
from sentry_sdk.scope import Scope
from sentry_sdk.sessions import track_session
from sentry_sdk.traces import (
SegmentNameSource,
Expand All @@ -37,7 +37,6 @@
_is_localhost,
capture_internal_exceptions,
event_from_exception,
has_data_collection_enabled,
logger,
reraise,
)
Expand Down Expand Up @@ -226,10 +225,7 @@ async def _run_app(
ip = _get_ip(scope)
if ip:
client_options = sentry_sdk.get_client().options
if has_data_collection_enabled(client_options):
if client_options["data_collection"]["user_info"]:
sentry_scope.set_attribute(SPANDATA.USER_IP_ADDRESS, ip)
elif should_send_default_pii():
if client_options["data_collection"]["user_info"]:
sentry_scope.set_attribute(SPANDATA.USER_IP_ADDRESS, ip)

if ty in ("http", "websocket"):
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/fastapi/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ async def test_request_info_json_body(sentry_init, capture_items):
async def test_formdata_request_body(sentry_init, capture_items):
sentry_init(
traces_sample_rate=1.0,
send_default_pii=True,
data_collection={},
max_request_body_size="always",
integrations=[StarletteIntegration()],
)
Expand Down
Loading