Skip to content

fix: replace removed sentry push_scope with new_scope - #1857

Open
itzzdev09 wants to merge 1 commit into
dimagi:mainfrom
itzzdev09:fix/sentry-sdk-3
Open

itzzdev09 wants to merge 1 commit into
dimagi:mainfrom
itzzdev09:fix/sentry-sdk-3

Conversation

@itzzdev09

Copy link
Copy Markdown

Product Description

None. No user-facing change.

Technical Summary

sentry-sdk 3.0 removed push_scope, which sentry_log_retry in config/celery_app.py uses. This replaces it with new_scope, which exists in both 2.x and 3.x. The lock pins 2.x today, so this only matters on upgrade.

Documentation

None.

Safety Assurance

Safety story

A one-line replacement; the tags and extra stay limited to the retry message.

Automated test coverage

No existing test calls sentry_log_retry. The handler was run against sentry-sdk 2.77.0 and 3.0.1.

QA Plan

Not needed.

Deployment

No configuration or manual steps are required.

  • This PR can be deployed: any required configuration, commands, or other manual steps required before this PR can be deployed are done.

Labels & Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Celery retry signal handler now uses sentry_sdk.new_scope() to create a Sentry scope. Its tagging, extra data, and warning-message behavior remain unchanged.

Changes: Retry logging

Layer / File(s) Summary
Create a Sentry scope
config/celery_app.py
sentry_log_retry uses sentry_sdk.new_scope() instead of sentry_sdk.push_scope().

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: sravfeyn, snopoke

Merge Risk: Minimal · up to 2c7e4

The retry logging handler now uses a Sentry API that exists in both 2.x and 3.x, so a future SDK upgrade will not break it. Tags, extra data, and the warning message are unchanged, and no production impact is expected.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the removed Sentry push_scope call is replaced with new_scope. The raw summary confirms the single-line change in config/celery_app.py matches this. The title is spec…
Description check Passed The description explains the reason for the change (sentry-sdk 3.0 removed push_scope, new_scope exists in 2.x and 3.x), the scope of the change in sentry_log_retry, the tested SDK versions, and the l…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: the removed Sentry push_scope call is replaced with new_scope. The raw summary confirms the single-line change in config/celery_app.py matches this. The title is specific and accurate.

Full details: Description check

Explanation

The description explains the reason for the change (sentry-sdk 3.0 removed push_scope, new_scope exists in 2.x and 3.x), the scope of the change in sentry_log_retry, the tested SDK versions, and the lack of user-facing impact. It is related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6c86417 and 2c7e44d.

Files selected for processing: 1

  • config/celery_app.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

This branch has not been deployed

No deployments
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