René's URL Explorer Experiment


Title: Version 0.17.8 broke Celery tasks with custom Task class · Issue #844 · getsentry/sentry-python · GitHub

Open Graph Title: Version 0.17.8 broke Celery tasks with custom Task class · Issue #844 · getsentry/sentry-python

X Title: Version 0.17.8 broke Celery tasks with custom Task class · Issue #844 · getsentry/sentry-python

Description: I am using tenant-schemas-celery package, which generates it's own TenantTask (extends celery.app.task.Task) class in it's own CeleryApp (extends celery.Celery). After updating from sentry-sdk from 0.17.7 to 0.17.8 the TenantTask's tenan...

Open Graph Description: I am using tenant-schemas-celery package, which generates it's own TenantTask (extends celery.app.task.Task) class in it's own CeleryApp (extends celery.Celery). After updating from sentry-sdk from...

X Description: I am using tenant-schemas-celery package, which generates it's own TenantTask (extends celery.app.task.Task) class in it's own CeleryApp (extends celery.Celery). After updating from sentry-...

Opengraph URL: https://github.com/getsentry/sentry-python/issues/844

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Version 0.17.8 broke Celery tasks with custom Task class","articleBody":"I am using [tenant-schemas-celery](https://github.com/maciej-gol/tenant-schemas-celery) package, which generates it's own TenantTask (extends celery.app.task.Task) class in it's own CeleryApp (extends celery.Celery). After updating from sentry-sdk from 0.17.7 to 0.17.8 the TenantTask's tenant context switching stopped working. I suspect this is because of the following change in 0.17.8:\r\n\r\n```\r\ndiff --git a/sentry_sdk/integrations/celery.py b/sentry_sdk/integrations/celery.py\r\nindex 1a11d4a..2b51fe1 100644\r\n--- a/sentry_sdk/integrations/celery.py\r\n+++ b/sentry_sdk/integrations/celery.py\r\n@@ -60,9 +60,8 @@ class CeleryIntegration(Integration):\r\n                 # Need to patch both methods because older celery sometimes\r\n                 # short-circuits to task.run if it thinks it's safe.\r\n                 task.__call__ = _wrap_task_call(task, task.__call__)\r\n                 task.run = _wrap_task_call(task, task.run)\r\n-                task.apply_async = _wrap_apply_async(task, task.apply_async)\r\n\r\n                 # `build_tracer` is apparently called for every task\r\n                 # invocation. Can't wrap every celery task for every invocation\r\n                 # or we will get infinitely nested wrapper functions.\r\n@@ -71,8 +70,12 @@ class CeleryIntegration(Integration):\r\n             return _wrap_tracer(task, old_build_tracer(name, task, *args, **kwargs))\r\n\r\n         trace.build_tracer = sentry_build_tracer\r\n\r\n+        from celery.app.task import Task  # type: ignore\r\n+\r\n+        Task.apply_async = _wrap_apply_async(Task.apply_async)\r\n+\r\n         _patch_worker_exit()\r\n\r\n         # This logger logs every status of every task that ran on the worker.\r\n         # Meaning that every task's breadcrumbs are full of stuff like \"Task\r\n```\r\n\r\nI think this problem has to do with this new way of importing celery.app.task.Task. Even though TenantTask extends the celery.app.task.Task, for some reason this change broke the TenantTask logic.\r\n\r\nI'm not sure which package this should be fixed in, but I'm bit skeptical about this new import in sentry-sdk, so I'm reporting it here.\r\n\r\nHere is my celery.py:\r\n\r\n```\r\nfrom tenant_schemas_celery.app import CeleryApp as TenantAwareCeleryApp\r\n\r\n\r\napp = TenantAwareCeleryApp()\r\napp.config_from_object('django.conf:settings')\r\napp.autodiscover_tasks()\r\n```","author":{"url":"https://github.com/akifd","@type":"Person","name":"akifd"},"datePublished":"2020-10-01T09:55:54Z","url":"https://github.com/getsentry/sentry-python/issues/844"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d1134d66-625a-abb3-76a1-096212462822
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA7B2:3BD860:58BB39:763677:6B00918B
html-safe-nonce66e3c33dbeae8a0ec22bbb961e6402bca4b0726cdeb14a3e623484f8e4b9bb04
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0IyOjNCRDg2MDo1OEJCMzk6NzYzNjc3OjZCMDA5MThCIiwidmlzaXRvcl9pZCI6IjQwMDczMzUwNjg4NTM4OTk2NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6e1a2827d34ccef1ea3793a4dd5320477f9652d316c920b59f3f1877cbc0fa4f
hovercard-subject-tagissue:712687639
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/844/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f422afacd0e0a3bf7116e3c44e52b58cd08f39d38213791f5e4d5091b8c32180/getsentry/sentry-python/issues/844
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f422afacd0e0a3bf7116e3c44e52b58cd08f39d38213791f5e4d5091b8c32180/getsentry/sentry-python/issues/844
og:image:altI am using tenant-schemas-celery package, which generates it's own TenantTask (extends celery.app.task.Task) class in it's own CeleryApp (extends celery.Celery). After updating from sentry-sdk from...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameakifd
hostnamegithub.com
expected-hostnamegithub.com
Nonec710a5cb5c47be60abfe6e8410436d409906979dbed614ef09f29c60f5535b08
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasebe616a2a6ec1c609d6e002896dff5352d5c5f28b
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/issues/844#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fissues%2F844
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fissues%2F844
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/issues/844
Reloadhttps://github.com/getsentry/sentry-python/issues/844
Reloadhttps://github.com/getsentry/sentry-python/issues/844
getsentryhttps://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Codehttps://github.com/getsentry/sentry-python
Issues345 (345)https://github.com/getsentry/sentry-python/issues
Pull requests41 (41)https://github.com/getsentry/sentry-python/pulls
Discussionshttps://github.com/getsentry/sentry-python/discussions
Actionshttps://github.com/getsentry/sentry-python/actions
Security and quality2 (2)https://github.com/getsentry/sentry-python/security
Insightshttps://github.com/getsentry/sentry-python/insights
https://github.com/getsentry/sentry-python
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-python/issues/844
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-python/issues/844
Version 0.17.8 broke Celery tasks with custom Task classhttps://github.com/getsentry/sentry-python/issues/844#top
https://github.com/sl0thentr0py
Bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Bug%22
Integration: Celeryhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Integration%3A%20Celery%22
https://github.com/akifd
akifdhttps://github.com/akifd
on Oct 1, 2020https://github.com/getsentry/sentry-python/issues/844#issue-712687639
tenant-schemas-celeryhttps://github.com/maciej-gol/tenant-schemas-celery
Nexthttps://github.com/getsentry/sentry-python/issues/844?timeline_page=1
https://github.com/untitaker
untitakerhttps://github.com/untitaker
on Oct 1, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-702034139
untitakerhttps://github.com/untitaker
bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22bug%22
on Oct 1, 2020https://github.com/getsentry/sentry-python/issues/844#event-3828665428
https://github.com/clintmod
clintmodhttps://github.com/clintmod
on Oct 19, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-712367410
https://github.com/clintmod
clintmodhttps://github.com/clintmod
on Oct 19, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-712377092
https://flask.palletsprojects.com/en/1.1.x/patterns/celery/#configurehttps://flask.palletsprojects.com/en/1.1.x/patterns/celery/#configure
https://github.com/untitaker
untitakerhttps://github.com/untitaker
on Oct 19, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-712377623
https://github.com/kwassholm-work
kwassholm-workhttps://github.com/kwassholm-work
on Oct 23, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-715287277
https://github.com/untitaker
untitakerhttps://github.com/untitaker
on Oct 23, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-715503416
@clintmodhttps://github.com/clintmod
https://github.com/ur001
ur001https://github.com/ur001
on Oct 23, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-715528488
@untitakerhttps://github.com/untitaker
https://github.com/kwassholm-work
kwassholm-workhttps://github.com/kwassholm-work
on Oct 24, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-715898264
https://github.com/untitaker
untitakerhttps://github.com/untitaker
on Oct 27, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-717293989
https://github.com/akifd
akifdhttps://github.com/akifd
on Nov 4, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-721595351
0.17.6...0.17.7#diff-bbcc458d29b0f1880cf429abbf8a94a5e8517f61072945d783e44fec4969a10bL96https://github.com/getsentry/sentry-python/compare/0.17.6...0.17.7#diff-bbcc458d29b0f1880cf429abbf8a94a5e8517f61072945d783e44fec4969a10bL96
https://github.com/kwassholm-work
kwassholm-workhttps://github.com/kwassholm-work
on Nov 9, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-724202591
https://github.com/clintmod
clintmodhttps://github.com/clintmod
on Nov 27, 2020https://github.com/getsentry/sentry-python/issues/844#issuecomment-734944989
https://github.com/ahmedetefy
ahmedetefyhttps://github.com/ahmedetefy
on Feb 11, 2021https://github.com/getsentry/sentry-python/issues/844#issuecomment-777705396
https://github.com/celery/celery/blob/4.3/celery/task/base.py#L126-L128https://github.com/celery/celery/blob/4.3/celery/task/base.py#L126-L128
https://github.com/celery/celery/blob/4.3/celery/app/task.py#L143-L145https://github.com/celery/celery/blob/4.3/celery/app/task.py#L143-L145
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Dec 23, 2021https://github.com/getsentry/sentry-python/issues/844#issuecomment-1000367329
sl0thentr0pyhttps://github.com/sl0thentr0py
needs-reprohttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22needs-repro%22
on Jul 22, 2022https://github.com/getsentry/sentry-python/issues/844#event-7046871512
https://github.com/fredbaa
fredbaahttps://github.com/fredbaa
on Jul 22, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1192630113
@sl0thentr0pyhttps://github.com/sl0thentr0py
https://github.com/sl0thentr0py
sl0thentr0pyhttps://github.com/sl0thentr0py
on Jul 25, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1194042967
@fredbaahttps://github.com/fredbaa
herehttps://github.com/sl0thentr0py/sentry_sample_apps/blob/main/python/django/sentry/celery.py#L22-L30
vladanpaunovichttps://github.com/vladanpaunovic
Status: Backloghttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Status%3A%20Backlog%22
on Jul 26, 2022https://github.com/getsentry/sentry-python/issues/844#event-7062847840
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
on Jul 27, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1196578171
@fredbaahttps://github.com/fredbaa
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Aug 18, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1218750068
github-actionshttps://github.com/apps/github-actions
Status: Stalehttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Status%3A%20Stale%22
on Aug 18, 2022https://github.com/getsentry/sentry-python/issues/844#event-7209936792
github-actionshttps://github.com/apps/github-actions
completedhttps://github.com/getsentry/sentry-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 25, 2022https://github.com/getsentry/sentry-python/issues/844#event-7255123730
https://github.com/shumakoff
shumakoffhttps://github.com/shumakoff
on Oct 7, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1271699756
https://github.com/sl0thentr0py
sl0thentr0pyhttps://github.com/sl0thentr0py
on Oct 7, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1271710281
https://github.com/shumakoff
shumakoffhttps://github.com/shumakoff
on Oct 10, 2022https://github.com/getsentry/sentry-python/issues/844#issuecomment-1273035385
#1151https://github.com/getsentry/sentry-python/pull/1151
https://github.com/grahamstreet
grahamstreethttps://github.com/grahamstreet
on Jan 14, 2023https://github.com/getsentry/sentry-python/issues/844#issuecomment-1382891224
3358c4dhttps://github.com/getsentry/sentry-python/commit/3358c4daf80aee3cbede623f6db17bf7026089bd
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
on Jun 20, 2023https://github.com/getsentry/sentry-python/issues/844#issuecomment-1598321384
https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/celery.py#L109https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/celery.py#L109
https://github.com/celery/celery/blob/v3.1.26/celery/app/task.py#LL209C20-L209C20https://github.com/celery/celery/blob/v3.1.26/celery/app/task.py#LL209C20-L209C20
https://github.com/celery/celery/blob/v4.4.7/celery/app/task.py#L144https://github.com/celery/celery/blob/v4.4.7/celery/app/task.py#L144
https://github.com/celery/celery/blob/v5.3.1/celery/app/task.py#L164https://github.com/celery/celery/blob/v5.3.1/celery/app/task.py#L164
stephanie-andersonhttps://github.com/stephanie-anderson
Type: Bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Type%3A%20Bug%22
on Nov 21, 2024https://github.com/getsentry/sentry-python/issues/844#event-15380725249
Bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Bug%22
on Aug 13, 2025https://github.com/getsentry/sentry-python/issues/844#event-19125085903
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-python/issues/844
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-python/issues/844
sl0thentr0pyhttps://github.com/sl0thentr0py
Bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Bug%22
Integration: Celeryhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Integration%3A%20Celery%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.