Skip to content

ref: Unify warnings (warnings.warn for deprecations, logging.warning for everything else) - #7268

Merged
sentrivana merged 4 commits into
major/3.0from
ivana/major/warnings-revamp
Aug 28, 2026
Merged

ref: Unify warnings (warnings.warn for deprecations, logging.warning for everything else)#7268
sentrivana merged 4 commits into
major/3.0from
ivana/major/warnings-revamp

Conversation

@sentrivana

@sentrivana sentrivana commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
  • Add a helper to use for deprecation warnings, specifically, that uses warnings.warn()
  • For everything but deprecation warnings, use logger.warning()

Closes https://linear.app/getsentry/issue/PY-1934/use-warningswarn-for-deprecations-and-loggerwarning-for-everything

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

110908 passed | ⏭️ 5428 skipped | Total: 116336 | Pass Rate: 95.33% | Execution Time: 373m 29s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -9047
Passed Tests 📉 -7743
Failed Tests
Skipped Tests 📉 -1304

All tests are passing successfully.

❌ Patch coverage is 67.74%. Project has 2228 uncovered lines.
✅ Project coverage is 90.64%. Comparing base (base) to head (head).

Files with missing lines (5)
File Patch % Lines
sentry_sdk/tracing_utils.py 0.00% ⚠️ 4 Missing
sentry_sdk/client.py 66.67% ⚠️ 2 Missing
sentry_sdk/scope.py 60.00% ⚠️ 2 Missing
sentry_sdk/integrations/threading.py 0.00% ⚠️ 1 Missing
sentry_sdk/traces.py 66.67% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    90.24%    90.64%     +0.4%
==========================================
  Files          193       185        -8
  Lines        25482     23803     -1679
  Branches      9384      8782      -602
==========================================
+ Hits         22994     21575     -1419
- Misses        2488      2228      -260
- Partials      1431      1363       -68

Generated by Codecov Action

@linear-code

linear-code Bot commented Aug 27, 2026

Copy link
Copy Markdown

PY-1934

@sentrivana
sentrivana marked this pull request as ready for review August 27, 2026 10:34
@sentrivana
sentrivana requested a review from a team as a code owner August 27, 2026 10:34
@sentrivana sentrivana changed the title ref: Change warnings ref: Unify warnings (warnings.warn for deprecations, logging.warning for everything else) Aug 27, 2026
Comment thread sentry_sdk/utils.py Outdated
@sentrivana
sentrivana merged commit 0783880 into major/3.0 Aug 28, 2026
127 checks passed
@sentrivana
sentrivana deleted the ivana/major/warnings-revamp branch August 28, 2026 07:06

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 56cb13b. Configure here.

Comment thread sentry_sdk/_compat.py
"We detected the use of uWSGI in preforking mode without "
"thread support. This might lead to crashing workers. "
'Please run uWSGI with both "--enable-threads" and '
'"--py-call-uwsgi-fork-hooks" for full support.'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warnings hidden unless debug enabled

High Severity

Switching these notices from warnings.warn() to logger.warning() hides them unless debug=True. The sentry_sdk.errors logger uses _DebugFilter, which drops records by default. Users will no longer see alerts about uWSGI crashing workers, ignored options, async close()/flush() misuse, or the Django Channels data-leak issue.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 56cb13b. Configure here.

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.

2 participants