Support Celery abstract tasks#1287
Merged
sl0thentr0py merged 3 commits intogetsentry:masterfrom Jan 4, 2022
Merged
Conversation
I have a use case for Celery [abstract tasks](https://docs.celeryproject.org/en/latest/userguide/application.html#abstract-tasks) to handle exceptions for an entire Celery app in a common way. Handled exceptions should be swallowed in the abstract task and never make it to Sentry. Prior to this change, the Celery integration always instruments `task.run` and incorrectly instruments `task.__call__` (`task(...)` is equivalent to `type(task).__call__(...)`, not `task.__call__(...)`). After this change, we'll use the same logic as Celery to decide whether to instrument `task.__call__` or `task.run`. That change allows abstract tasks to catch/raise exceptions before the Sentry wrapper.
Contributor
Author
|
Fixed the linting errors. Should be ready for another CI run |
Member
|
@johnzeringue thx for the contribution! Can you first rebase on master and push again? |
sl0thentr0py
approved these changes
Jan 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have a use case for Celery abstract
tasks
to handle exceptions for an entire Celery app in a common way. Handled
exceptions should be swallowed in the abstract task and never make it to
Sentry.
Prior to this change, the Celery integration always instruments
task.runand incorrectly instrumentstask.__call__(task(...)isequivalent to
type(task).__call__(...), nottask.__call__(...)).After this change, we'll use the same logic as Celery to decide whether
to instrument
task.__call__ortask.run. That change allows abstracttasks to catch/raise exceptions before the Sentry wrapper.