mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Sentry: Do not report retried celery tasks
This commit is contained in:
@@ -2,6 +2,7 @@ import re
|
|||||||
import weakref
|
import weakref
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from celery.exceptions import Retry
|
||||||
from sentry_sdk import Hub
|
from sentry_sdk import Hub
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration, _set_user_info
|
from sentry_sdk.integrations.django import DjangoIntegration, _set_user_info
|
||||||
from sentry_sdk.utils import capture_internal_exceptions
|
from sentry_sdk.utils import capture_internal_exceptions
|
||||||
@@ -94,3 +95,15 @@ class PretixSentryIntegration(DjangoIntegration):
|
|||||||
return old_get_response(self, request)
|
return old_get_response(self, request)
|
||||||
|
|
||||||
BaseHandler.get_response = sentry_patched_get_response
|
BaseHandler.get_response = sentry_patched_get_response
|
||||||
|
|
||||||
|
|
||||||
|
def ignore_retry(event, hint):
|
||||||
|
with capture_internal_exceptions():
|
||||||
|
if isinstance(hint["exc_info"][1], Retry):
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def setup_custom_filters():
|
||||||
|
hub = Hub.current
|
||||||
|
with hub.configure_scope() as scope:
|
||||||
|
scope.add_event_processor(ignore_retry)
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ if config.has_option('sentry', 'dsn'):
|
|||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||||
from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger
|
from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger
|
||||||
from .sentry import PretixSentryIntegration
|
from .sentry import PretixSentryIntegration, setup_custom_filters
|
||||||
|
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
dsn=config.get('sentry', 'dsn'),
|
dsn=config.get('sentry', 'dsn'),
|
||||||
@@ -587,9 +587,7 @@ if config.has_option('sentry', 'dsn'):
|
|||||||
|
|
||||||
)
|
)
|
||||||
ignore_logger('pretix.base.tasks')
|
ignore_logger('pretix.base.tasks')
|
||||||
ignore_logger('pretix.plugins.stripe')
|
setup_custom_filters()
|
||||||
ignore_logger('pretix.plugins.paypal')
|
|
||||||
ignore_logger('pretix.plugins.banktransfer')
|
|
||||||
|
|
||||||
CELERY_TASK_SERIALIZER = 'json'
|
CELERY_TASK_SERIALIZER = 'json'
|
||||||
CELERY_RESULT_SERIALIZER = 'json'
|
CELERY_RESULT_SERIALIZER = 'json'
|
||||||
|
|||||||
Reference in New Issue
Block a user