Skip to content

feat(sanic): Gate user info behind data_collection config#6870

Open
ericapisani wants to merge 2 commits into
py-2583-django-user-infofrom
py-2583-sanic-user-info
Open

feat(sanic): Gate user info behind data_collection config#6870
ericapisani wants to merge 2 commits into
py-2583-django-user-infofrom
py-2583-sanic-user-info

Conversation

@ericapisani

@ericapisani ericapisani commented Jul 23, 2026

Copy link
Copy Markdown
Member

Apply the data_collection.user_info setting to the Sanic integration's user IP collection, giving it precedence over the legacy send_default_pii boolean when explicitly configured. This covers both the user.ip_address scope attribute applied to all spans and the client.address span attribute, mirroring the behavior already shipped for Flask, WSGI, ASGI, and Django.

The user IP span test is reparametrized with the shared DATA_COLLECTION_USER_INFO_CASES matrix from tests/integrations/utils.py, and a new test covers the previously untested client.address span attribute.

Refs PY-2583
Refs #6746

@linear-code

linear-code Bot commented Jul 23, 2026

Copy link
Copy Markdown

PY-2583

@ericapisani ericapisani changed the title py 2583 sanic user info feat(sanic): Gate user info behind data_collection config Jul 23, 2026
@ericapisani
ericapisani marked this pull request as ready for review July 23, 2026 14:44
@ericapisani
ericapisani requested a review from a team as a code owner July 23, 2026 14:44
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

96492 passed | ⏭️ 6410 skipped | Total: 102902 | Pass Rate: 93.77% | Execution Time: 345m 39s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +632
Passed Tests 📈 +562
Failed Tests
Skipped Tests 📈 +70

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2511 uncovered lines.
✅ Project coverage is 89.69%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.68%    89.69%    +0.01%
==========================================
  Files          193       193         —
  Lines        24321     24344       +23
  Branches      8572      8596       +24
==========================================
+ Hits         21809     21833       +24
- Misses        2512      2511        -1
- Partials      1397      1394        -3

Generated by Codecov Action

Move the identical USER_INFO_INIT_KWARGS parametrization from the flask, wsgi, and django test suites into tests/integrations/utils.py as DATA_COLLECTION_USER_INFO_CASES, documenting that the second element of each case is whether user info is expected to be collected.
Apply the data_collection.user_info setting to the Sanic integration's user IP collection, giving it precedence over the legacy send_default_pii boolean when explicitly configured. This covers both the user.ip_address scope attribute applied to all spans and the client.address span attribute, mirroring the behavior already shipped for Flask, WSGI, ASGI, and Django.

The user IP span test is reparametrized with the shared DATA_COLLECTION_USER_INFO_CASES matrix from tests/integrations/utils.py, and a new test covers the previously untested client.address span attribute.

Refs PY-2583
@ericapisani
ericapisani force-pushed the py-2583-django-user-info branch from 615580f to 4ee42d0 Compare July 23, 2026 18:15
@ericapisani
ericapisani force-pushed the py-2583-sanic-user-info branch from 4a557fc to 057caa4 Compare July 23, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant