diff options
author | dhoffman <me@davidhoffman.ca> | 2017-09-07 11:50:59 -0400 |
---|---|---|
committer | David Cramer <dcramer@gmail.com> | 2017-09-16 11:17:58 -0700 |
commit | d796576b5dea8c4e50c3141ce6e10dea02cd7fdf (patch) | |
tree | d06916ddccf9510f15e5fef3f5b8794b8dffdcc5 | |
parent | 96281980c33a74af70e2b1e84d6a72185870b50b (diff) | |
download | raven-d796576b5dea8c4e50c3141ce6e10dea02cd7fdf.tar.gz |
Added Django setting to ignore expected Celery errors
-rw-r--r-- | docs/integrations/django.rst | 6 | ||||
-rw-r--r-- | raven/contrib/django/models.py | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/docs/integrations/django.rst b/docs/integrations/django.rst index c10b7ea..1bd634d 100644 --- a/docs/integrations/django.rst +++ b/docs/integrations/django.rst @@ -296,6 +296,12 @@ Additional Settings 'CELERY_LOGLEVEL': logging.INFO } +.. describe:: SENTRY_CELERY_IGNORE_EXPECTED + + If you are also using Celery, then you can ignore expected exceptions by + setting this to ``True``. This will cause exception classes in + ``Task.throws`` to be ignored. + Caveats ------- diff --git a/raven/contrib/django/models.py b/raven/contrib/django/models.py index 149ef9f..2ee0ebb 100644 --- a/raven/contrib/django/models.py +++ b/raven/contrib/django/models.py @@ -165,7 +165,13 @@ class SentryDjangoHandler(object): SentryCeleryHandler, register_logger_signal ) - self.celery_handler = SentryCeleryHandler(client).install() + ignore_expected = getattr(settings, + 'SENTRY_CELERY_IGNORE_EXPECTED', + False) + + self.celery_handler = SentryCeleryHandler(client, + ignore_expected=ignore_expected)\ + .install() # try: # ga = lambda x, d=None: getattr(settings, 'SENTRY_%s' % x, d) |