Greetings fellows!
We are having an issue with CeleryIntegration in Sentry SDK.
Python 3.6.7
Django 2.1.5
Celery 4.1.1
Sentry SDK 0.7.0-0.7.1
In our code (internal and 3rd-party) we are using Celery tasks retry functionality.
The app.Task.retry() call will raise an exception so any code after the retry won鈥檛 be reached. This is the Retry exception, it isn鈥檛 handled as an error but rather as a semi-predicate to signify to the worker that the task is to be retried, so that it can store the correct state when a result backend is enabled.
We did switch recently from Raven to Sentry SDK 0.6.9, everything seemed working as before.
But today we updated it to 0.7.0 release (and later to 0.7.1)
This caused every celery.exceptions.Retry to be sent to Sentry, which quickly filled Sentry server with thousands of events.
Previously (in old SDK and Raven), those exceptions were ignored and not sent to Sentry server.
CeleryIntegration is not flooding Sentry server with every retry exception. Basically, the same behavior as it was in Raven and Sentry SDK<0.7.0.
I am not sure if the old behavior was done intentionally or by mistake.
If that was intended, we should reimplement it in current integration.
If not, there should be a way to filter/ignore that kind of exceptions (I am not sure if we can filter all retries from internal and 3rd-party code inbefore_send in a clean way).
Could you help me to clarify this issue?
This is absolutely a regression. Thanks for reporting! We recently rewrote the Celery integration in an attempt to fix other bugs. We will fix this within 1-2 days
def before_send(event, hint):
try:
if isinstance(hint['exc_info'][1], Retry):
return None
except Exception:
pass
return event
@untitaker sounds great! Looking forward to getting #253 merged.
fyi this has been released in 0.7.2 yesterday
@untitaker yes, that is great! We did deploy it today and seeing no retry issues in our Sentry.
Well done! 馃弲
that's nice, just forgot to update this ticket :)
Most helpful comment
253 should work, or you can use this: