Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit d796576

Browse files
dhoffman34dcramer
authored andcommitted
Added Django setting to ignore expected Celery errors
1 parent 9628198 commit d796576

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

docs/integrations/django.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ Additional Settings
296296
'CELERY_LOGLEVEL': logging.INFO
297297
}
298298

299+
.. describe:: SENTRY_CELERY_IGNORE_EXPECTED
300+
301+
If you are also using Celery, then you can ignore expected exceptions by
302+
setting this to ``True``. This will cause exception classes in
303+
``Task.throws`` to be ignored.
304+
299305
Caveats
300306
-------
301307

raven/contrib/django/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ def install_celery(self):
165165
SentryCeleryHandler, register_logger_signal
166166
)
167167

168-
self.celery_handler = SentryCeleryHandler(client).install()
168+
ignore_expected = getattr(settings,
169+
'SENTRY_CELERY_IGNORE_EXPECTED',
170+
False)
171+
172+
self.celery_handler = SentryCeleryHandler(client,
173+
ignore_expected=ignore_expected)\
174+
.install()
169175

170176
# try:
171177
# ga = lambda x, d=None: getattr(settings, 'SENTRY_%s' % x, d)

0 commit comments

Comments
 (0)