def configure_sentry(base_dir, server_env, dsn): import sentry_sdk from sentry_sdk.integrations.celery import CeleryIntegration from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.logging import ignore_logger from sentry_sdk.integrations.redis import RedisIntegration from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration def _before_send(event, hint): # can't import this during load since settings is not fully configured yet from corehq.util.sentry import before_sentry_send return before_sentry_send(event, hint) release = get_release_name(base_dir, server_env) ignore_logger('quickcache') ignore_logger('django.template') ignore_logger('pillowtop') ignore_logger('restore') ignore_logger('kafka.conn') sentry_sdk.init(dsn, release=release, environment=server_env, request_bodies='never', before_send=_before_send, integrations=[ DjangoIntegration(), CeleryIntegration(), SqlalchemyIntegration(), RedisIntegration() ])
def setup_once() -> None: ignore_logger('tornado.access') old_execute = RequestHandler._execute # type: ignore async def sentry_execute_request_handler(self, *args, **kwargs): # type: (Any, *Any, **Any) -> Any hub = Hub.current weak_handler = weakref.ref(self) with Hub(hub) as hub: with hub.configure_scope() as scope: scope.clear_breadcrumbs() processor = _make_event_processor(weak_handler) scope.add_event_processor(processor) return await old_execute(self, *args, **kwargs) RequestHandler._execute = sentry_execute_request_handler old_log_exception = RequestHandler.log_exception def sentry_log_exception(self, ty, value, tb, *args, **kwargs): # type: (Any, type, BaseException, Any, *Any, **Any) -> Optional[Any] # NOQA if issubclass(ty, BaseError): if value.alert_sentry: _capture_exception(ty, value, tb) elif not issubclass(ty, MarshmallowError): _capture_exception(ty, value, tb) return old_log_exception(self, ty, value, tb) # type: ignore RequestHandler.log_exception = sentry_log_exception # type: ignore
def __init__(self, sentry_conn_id="sentry_dsn"): ignore_logger("airflow.task") ignore_logger("airflow.jobs.backfill_job.BackfillJob") executor_name = conf.get("core", "EXECUTOR") integrations = [FlaskIntegration(), SqlalchemyIntegration()] traces_sample_rate = (1 if os.environ.get("SENTRY_ENABLE_AIRFLOW_APM") in ["true", "True"] else 0) try: dsn = None conn = self.get_connection(sentry_conn_id) dsn = get_dsn(conn) sentry_sdk.init( dsn=dsn, integrations=integrations, traces_sample_rate=traces_sample_rate, ) except (AirflowException, exc.OperationalError, exc.ProgrammingError): self.log.debug("Sentry defaulting to environment variable.") sentry_sdk.init(integrations=integrations, traces_sample_rate=traces_sample_rate) if traces_sample_rate is 0: TaskInstance._run_raw_task = sentry_patched_run_raw_task else: self.log.debug("Sentry sending APM spans.") TaskInstance._run_raw_task = sentry_patched_run_raw_task_with_span TaskInstance._sentry_integration_ = True
def includeme(config): """Set up the error tracking service.""" filters = [ # Allow functions to be passed as strings: e.g. "module.function" config.maybe_dotted(_filter) for _filter in config.registry.settings.get("h_pyramid_sentry.filters", []) ] if asbool(config.registry.settings.get("h_pyramid_sentry.retry_support")): # pylint:disable=import-outside-toplevel # This is here to lazy load only when required from h_pyramid_sentry.filters.pyramid import is_retryable_error filters.append(is_retryable_error) config.scan("h_pyramid_sentry.subscribers") init_options = {**DEFAULT_OPTIONS} for key, value in config.registry.settings.items(): match = OPTION_PATTERN.match(key) if match: init_options[match.group(1)] = value if asbool(config.registry.settings.get("h_pyramid_sentry.celery_support")): # pylint:disable=import-outside-toplevel # This is here to lazy load only when required from sentry_sdk.integrations.celery import CeleryIntegration init_options["integrations"].append(CeleryIntegration()) if asbool( config.registry.settings.get( "h_pyramid_sentry.sqlalchemy_support")): # pylint:disable=import-outside-toplevel from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration init_options["integrations"].append(SqlalchemyIntegration()) # exc_logger (which comes from # https://docs.pylonsproject.org/projects/pyramid_exclog/) logs all # exceptions with log level ERROR, and then all of these get picked up by # sentry_sdk's enabled-by-default logging integration # (https://docs.sentry.io/platforms/python/logging/). # # This means that: # # 1. All exceptions get reported via exc_logger instead of via sentry_sdk's # normal route (of intercepting raised exceptions) # # 2. Some handled exceptions that wouldn't have been reported via the # normal route now do get reported because exc_logger logs them as errors. # # We don't want either of these two things to happen so tell sentry_sdk's # logging integration to ignore exc_logger (see # https://docs.sentry.io/platforms/python/logging/#ignoring-a-logger). # # If pyramd_exclog isn't installed this will just have no effect. ignore_logger("exc_logger") # pylint: disable=abstract-class-instantiated sentry_sdk.init(before_send=get_before_send(filters), **init_options)
def __init__(self): """ Initialize the Sentry SDK. """ ignore_logger("airflow.task") ignore_logger("airflow.jobs.backfill_job.BackfillJob") executor_name = conf.get("core", "EXECUTOR") sentry_flask = FlaskIntegration() # LoggingIntegration is set by default. integrations = [sentry_flask] if executor_name == "CeleryExecutor": from sentry_sdk.integrations.celery import CeleryIntegration sentry_celery = CeleryIntegration() integrations.append(sentry_celery) dsn = conf.get("sentry", "sentry_dsn") if dsn: init(dsn=dsn, integrations=integrations) else: # Setting up Sentry using environment variables. log.debug("Defaulting to SENTRY_DSN in environment.") init(integrations=integrations)
def sentry_logger(conf, name, log_to_console, log_route, fmt, logger, adapted_logger): """ sentry_logger sets up a custom log handler hook for Swift. Its parameters are the same as Swift’s get_logger function (as well as the getLogger and LogAdapter object). The log handler hook is essenitially a no-op, it is called in order to initialise Sentry using the init() at the module level. We could, of course, set things up by manually adding the Handlers to the specific logger (as stated in the Swift docs) but that would result in code duplication from the SDK. This approach is better since it allows Sentry to capture all events instead of just capturing the events from the loggers that Swift gives us control over. """ sentry_ignore_loggers = conf.get("sentry_ignore_loggers", None) if sentry_ignore_loggers: ignore_loggers_list = [ s.strip() for s in sentry_ignore_loggers.split(",") if s.strip() ] for lgr in ignore_loggers_list: ignore_logger(lgr)
def configure(**sentry_sdk_init_kwargs): for logger in IGNORE_LOGGERS: ignore_logger(logger) logging_integration = LoggingIntegration() attr_map = [ StructlogAwareMessageFormatter.AttrMapItem( record_attr_name='request_id', event_dict_key='request_id', default_value=None) ] # We attach our structlog aware formatter to sentry logging handlers for attr_name, attr_value in vars(logging_integration).items(): if isinstance(attr_value, logging.Handler): # we have to pass copy_record False because Sentry handler expects inplace formatting # Fortunately, Sentry's handlers are called last in chain attr_value.setFormatter( StructlogAwareMessageFormatter(copy_record=False, attr_map=attr_map)) sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration(), logging_integration], environment=ENVIRONMENT, **sentry_sdk_init_kwargs)
def setup_once(): # type: () -> None import celery.app.trace as trace # type: ignore old_build_tracer = trace.build_tracer def sentry_build_tracer(name, task, *args, **kwargs): if not getattr(task, "_sentry_is_patched", False): # Need to patch both methods because older celery sometimes # short-circuits to task.run if it thinks it's safe. task.__call__ = _wrap_task_call(task, task.__call__) task.run = _wrap_task_call(task, task.run) task.apply_async = _wrap_apply_async(task, task.apply_async) # `build_tracer` is apparently called for every task # invocation. Can't wrap every celery task for every invocation # or we will get infinitely nested wrapper functions. task._sentry_is_patched = True return _wrap_tracer(task, old_build_tracer(name, task, *args, **kwargs)) trace.build_tracer = sentry_build_tracer _patch_worker_exit() # This logger logs every status of every task that ran on the worker. # Meaning that every task's breadcrumbs are full of stuff like "Task # <foo> raised unexpected <bar>". ignore_logger("celery.worker.job") ignore_logger("celery.app.trace")
def __init__(self, config): self.config = config dsn = config.SENTRY_DSN_URL if not dsn: raise RuntimeError(""" If you set USE_CUSTOM_ERROR_HANDLING to True, and you are using thumbor.error_handlers.sentry, then you must specify the Sentry DSN using the SENTRY_DSN_URL configuration." """) kwargs = { "dsn": dsn, "integrations": [], } env = config.get("SENTRY_ENVIRONMENT") if env is not None: kwargs["environment"] = env # Logging integration will create duplicates if below not ignored ignore_logger("thumbor") ignore_logger("tornado.access") sentry_sdk.init(**kwargs)
def __init__(self, sentry_conn_id=None): ignore_logger("airflow.task") ignore_logger("airflow.jobs.backfill_job.BackfillJob") executor_name = conf.get("core", "EXECUTOR") sentry_flask = FlaskIntegration() integrations = [sentry_flask] if executor_name == "CeleryExecutor": from sentry_sdk.integrations.celery import CeleryIntegration sentry_celery = CeleryIntegration() integrations += [sentry_celery] try: conn_id = None dsn = None if sentry_conn_id is None: conn_id = self.get_connection("sentry_dsn") else: conn_id = self.get_connection(sentry_conn_id) dsn = conn_id.host init(dsn=dsn, integrations=integrations) except (AirflowException, exc.OperationalError, exc.ProgrammingError): self.log.debug("Sentry defaulting to environment variable.") init(integrations=integrations) TaskInstance._run_raw_task = add_sentry TaskInstance._sentry_integration_ = True
def install_sql_hook(): # type: () -> None """If installed this causes Django's queries to be captured.""" try: from django.db.backends.utils import CursorWrapper # type: ignore except ImportError: from django.db.backends.util import CursorWrapper # type: ignore try: real_execute = CursorWrapper.execute real_executemany = CursorWrapper.executemany except AttributeError: # This won't work on Django versions < 1.6 return def record_many_sql(sql, param_list): for params in param_list: record_sql(sql, params) def execute(self, sql, params=None): try: return real_execute(self, sql, params) finally: record_sql(sql, params) def executemany(self, sql, param_list): try: return real_executemany(self, sql, param_list) finally: record_many_sql(sql, param_list) CursorWrapper.execute = execute CursorWrapper.executemany = executemany ignore_logger("django.db.backends")
def setup_sentry(app: FastAPI): if config.DSN: # pragma: no cover ignore_logger("asyncio") logger.debug("setup sentry") sentry_sdk.init(dsn=config.DSN, release=config.COMMIT_SHA, integrations=[RedisIntegration()]) app.add_middleware(SentryAsgiMiddleware)
def SENTRY_INIT(dsn: str, sentry_opts: dict): """Init function for sentry. Will only be called if SENTRY_DSN is not None, during core start, can be overriden in separate settings file. """ sentry_sdk.init(dsn, **sentry_opts) ignore_logger("graphql.execution.utils")
def ignore_graphene_logger(): """ A utils function that can be called to ignore a graphene logger that logs errors as strings instead of errors. This leads to a loss of Sentry's features. Instead, you can report the original exception. Test for: * sentry_sdk >= 0.13.0 """ ignore_logger('graphql.execution.utils')
def setup_once(): task_prerun.connect(_handle_task_prerun, weak=False) task_postrun.connect(_handle_task_postrun, weak=False) task_failure.connect(_process_failure_signal, weak=False) # This logger logs every status of every task that ran on the worker. # Meaning that every task's breadcrumbs are full of stuff like "Task # <foo> raised unexpected <bar>". ignore_logger("celery.worker.job")
def test_ignore_logger(sentry_init, capture_events): sentry_init(integrations=[LoggingIntegration()], default_integrations=False) events = capture_events() ignore_logger("testfoo") other_logger.error("hi") assert not events
def configure_sentry(ignore_logger, sentry_sdk): ignore_logger(LOGGER_NAME) config = configparser.ConfigParser() config.read(APP_CONFIG) env = "development" if os.environ.get( "protonvpn_env") else "production" # noqa sentry_sdk.init(dsn=config["sentry"]["dsn"], ignore_errors=["KeyboardInterrupt"], release="protonvpn-nm-core@" + APP_VERSION, environment=env)
def initialize_sentry(config): """ Setup an instance of :class:`sentry_sdk.Client`. :param config: Sentry configuration :param client: class used to instantiate the sentry_sdk client. """ enabled = config.get("sentry_enabled", False) if not (HAS_SENTRY_SDK and enabled): return _logger.info("Initializing sentry...") if config.get("sentry_odoo_dir") and config.get("sentry_release"): _logger.debug("Both sentry_odoo_dir and \ sentry_release defined, choosing sentry_release") options = { "release": config.get("sentry_release", get_odoo_commit(config.get("sentry_odoo_dir"))), } for option in const.get_sentry_options(): value = config.get('sentry_%s' % option.key, option.default) if isinstance(option.converter, collections.Callable): value = option.converter(value) options[option.key] = value exclude_loggers = const.split_multiple( config.get("sentry_exclude_loggers", const.DEFAULT_EXCLUDE_LOGGERS) ) # Change name `ignore_exceptions` (with raven) # to `ignore_errors' (sentry_sdk) options["ignore_errors"] = options["ignore_exceptions"] del options["ignore_exceptions"] options["before_send"] = before_send options["integrations"] = [options["logging_level"], ThreadingIntegration(propagate_hub=True)] # Remove logging_level, since in sentry_sdk is include in 'integrations' del options["logging_level"] client = sentry_sdk.init(**options) sentry_sdk.set_tag("include_context", config.get("sentry_include_context", True)) if exclude_loggers: for item in exclude_loggers: ignore_logger(item) wsgi_server.application = SentryWsgiMiddleware(wsgi_server.application) with sentry_sdk.push_scope() as scope: scope.set_extra("debug", False) sentry_sdk.capture_message("Starting Odoo Server", "info") return client
def init_error_collection(celery=False): if settings.SENTRY_DSN: sentry_sdk.init( dsn=settings.SENTRY_DSN, integrations=[CeleryIntegration(), DjangoIntegration(), RedisIntegration()], send_default_pii=True, release=weblate.GIT_REVISION or weblate.VERSION, ) ignore_logger("weblate.celery") if celery and HAS_ROLLBAR and hasattr(settings, 'ROLLBAR'): rollbar.init(**settings.ROLLBAR) rollbar.BASE_DATA_HOOK = celery_base_data_hook
def from_crawler(cls, crawler): """ Initialize the extension from a crawler instance and connect to the `spider_error` signal. """ extension = cls() crawler.signals.connect(extension.spider_error, signal=signals.spider_error) # ignore sentry logger ignore_logger('scrapy.core.scraper') return extension
def init_sentry(self): # sentry log handler sentry_logging = LoggingIntegration( level=logging.INFO, # Capture info and above as breadcrumbs event_level=logging.ERROR # Send errors as events ) # init sentry logging sentry_sdk.init( dsn="https://[email protected]/2?verify_ssl=0", integrations=[sentry_logging], release=sickrage.version(), environment=('master', 'develop')['dev' in sickrage.version()], ignore_errors=[ 'KeyboardInterrupt', 'PermissionError', 'FileNotFoundError', 'EpisodeNotFoundException' ] ) # sentry tags sentry_tags = { 'platform': platform.platform(), 'locale': repr(locale.getdefaultlocale()), 'python': platform.python_version(), 'install_type': sickrage.install_type() } # set sentry tags for tag_key, tag_value in sentry_tags.items(): sentry_sdk.set_tag(tag_key, tag_value) # set loggers to ignore ignored_loggers = [ 'enzyme.parsers.ebml.core', 'subliminal.core', 'subliminal.utils', 'subliminal.refiners.tvdb', 'subliminal.refiners.metadata', 'subliminal.providers.tvsubtitles', 'pika.connection', 'pika.adapters.base_connection', 'pika.adapters.utils.io_services_utils', 'pika.adapters.utils.connection_workflow', 'pika.adapters.utils.selector_ioloop_adapter' ] for item in ignored_loggers: ignore_logger(item)
def init(self, sentry_url='', release_version='', scrubber=None, strategy=SentryStrategy.SEND_ALLOWED_WITH_CONFIRMATION): """Initialization. This method should be called in each process that uses SentryReporter. Args: sentry_url: URL for Sentry server. If it is empty then Sentry's sending mechanism will not be initialized. scrubber: a class that will be used for scrubbing sending events. Only a single method should be implemented in the class: ``` def scrub_event(self, event): pass ``` release_version: string that represents a release version. See Also: https://docs.sentry.io/platforms/python/configuration/releases/ strategy: a Sentry strategy for sending events (see class Strategy for more information) Returns: Sentry Guard. """ self._logger.debug(f"Init: {sentry_url}") self.scrubber = scrubber self.global_strategy = strategy rv = sentry_sdk.init( sentry_url, release=release_version, # https://docs.sentry.io/platforms/python/configuration/integrations/ integrations=[ LoggingIntegration( level=logging. INFO, # Capture info and above as breadcrumbs event_level=None, # Send no errors as events ), ThreadingIntegration(propagate_hub=True), ], before_send=self._before_send, ignore_errors=[KeyboardInterrupt], ) ignore_logger(self._sentry_logger_name) return rv
def hijack_loggers(loggers, level=logging.INFO): """ Context manager to temporarily set the handler of each logger in `loggers`. Parameters ---------- loggers: list of str Loggers to change level: logging LEVEL int Level to set the temporary handler to Returns ------- ListHandler The handler that will be temporarily assigned to each logger. Notes ----- This may not capture all records when used in a distributed or multiprocessing workflow """ handler = ListHandler() handler.setLevel(level) all_loggers = set() for name in loggers: all_loggers.add(name) all_loggers |= _get_children(name) logger_info = {} for name in all_loggers: logger = logging.getLogger(name) logger_info[name] = (logger.handlers, logger.propagate) logger.handlers = [handler] sentry_logging.ignore_logger(name) logger.propagate = False yield handler for name in all_loggers: logger = logging.getLogger(name) hnd, prop = logger_info[name] logger.handlers = hnd logger.propagate = prop try: sentry_logging._IGNORED_LOGGERS.remove(name) except Exception: pass del handler
def test_ignore_logger_wildcard(sentry_init, capture_events): sentry_init(integrations=[LoggingIntegration()], default_integrations=False) events = capture_events() ignore_logger("testfoo.*") nested_logger = logging.getLogger("testfoo.submodule") logger.error("hi") nested_logger.error("bye") (event, ) = events assert event["logentry"]["message"] == "hi"
def init_error_collection(celery=False): if settings.SENTRY_DSN: sentry_sdk.init( dsn=settings.SENTRY_DSN, integrations=[CeleryIntegration(), DjangoIntegration(), RedisIntegration()], send_default_pii=True, release=weblate.GIT_REVISION or weblate.TAG_NAME, environment=settings.SENTRY_ENVIRONMENT, **settings.SENTRY_EXTRA_ARGS, ) # Ignore Weblate logging, those are reported using capture_exception ignore_logger(ERROR_LOGGER) if celery and HAS_ROLLBAR and hasattr(settings, "ROLLBAR"): rollbar.init(**settings.ROLLBAR) rollbar.BASE_DATA_HOOK = celery_base_data_hook
def sdk_init(global_conf, dsn, level='INFO', event_level='ERROR', ignorelist=''): sentry_logging = LoggingIntegration( level=logging.__dict__[level], event_level=logging.__dict__[event_level]) for logger in ignorelist.split(): ignore_logger(logger) def filter(app): sentry_sdk.init(dsn=dsn, integrations=[sentry_logging]) return app return filter
def init_app(app, testmode=False): # We load configurations first from the config file (where some options # are overridable via environment variables) or from the config file # pointed to by the MEASUREMENTS_CONFIG environment variable. # The later overrides the former. app.config.from_object("measurements.config") app.config.from_envvar("MEASUREMENTS_CONFIG", silent=True) # Prevent messy duplicate logs during testing if not testmode: app.logger.addHandler(logging.StreamHandler()) if app.config["APP_ENV"] == "production": app.logger.setLevel(logging.WARNING) elif app.config["APP_ENV"] == "development": app.logger.setLevel(logging.DEBUG) # Set the jinja templates to reload when in development app.jinja_env.auto_reload = True app.config["TEMPLATES_AUTO_RELOAD"] = True app.config["DEBUG"] = True elif app.config["APP_ENV"] not in ( "testing", "staging", ): # known envs according to Readme.md raise RuntimeError("Unexpected APP_ENV", app.config["APP_ENV"]) for key in app.config.keys(): SECRET_SUBSTRINGS = ["_SECRET_", "DATABASE_URL"] # Do not log, even in debug, anything containing the word "SECRET" or "DATABASE_URL" if any([s in key for s in SECRET_SUBSTRINGS]): continue app.logger.debug("{}: {}".format(key, app.config[key])) if app.config["APP_ENV"] == "production": sentry_sdk.init( dsn="https://[email protected]/1367288", integrations=[FlaskIntegration()], ) # TODO Temporary workaround to ignore flask-limiter logs due to: # https://github.com/ooni/api/issues/145 & # https://github.com/alisaifee/flask-limiter/issues/186 ignore_logger("flask-limiter") md = Misaka(fenced_code=True) md.init_app(app) CORS(app, resources={r"/api/*": {"origins": "*"}})
def setup_once(): # type: () -> None if TORNADO_VERSION < (5, 0): raise DidNotEnable("Tornado 5+ required") if not HAS_REAL_CONTEXTVARS: # Tornado is async. We better have contextvars or we're going to leak # state between requests. raise DidNotEnable( "The tornado integration for Sentry requires Python 3.7+ or the aiocontextvars package" + CONTEXTVARS_ERROR_MESSAGE ) ignore_logger("tornado.access") old_execute = RequestHandler._execute # type: ignore awaitable = iscoroutinefunction(old_execute) if awaitable: # Starting Tornado 6 RequestHandler._execute method is a standard Python coroutine (async/await) # In that case our method should be a coroutine function too async def sentry_execute_request_handler(self, *args, **kwargs): # type: (RequestHandler, *Any, **Any) -> Any with _handle_request_impl(self): return await old_execute(self, *args, **kwargs) else: @coroutine # type: ignore def sentry_execute_request_handler(self, *args, **kwargs): # type: ignore # type: (RequestHandler, *Any, **Any) -> Any with _handle_request_impl(self): result = yield from old_execute(self, *args, **kwargs) return result RequestHandler._execute = sentry_execute_request_handler # type: ignore old_log_exception = RequestHandler.log_exception def sentry_log_exception(self, ty, value, tb, *args, **kwargs): # type: (Any, type, BaseException, Any, *Any, **Any) -> Optional[Any] _capture_exception(ty, value, tb) return old_log_exception(self, ty, value, tb, *args, **kwargs) # type: ignore RequestHandler.log_exception = sentry_log_exception # type: ignore
def __init__(self, sentry_url): self.sentry_client = None if not sentry_url: return kwargs = { "dsn": sentry_url, "integrations": [], } # Logging integration will create duplicates if below not ignored ignore_logger("thumbor") ignore_logger("tornado.access") sentry_sdk.init(**kwargs) self.install_handler()
def install_sql_hook(): # type: () -> None """If installed this causes Django's queries to be captured.""" try: from django.db.backends.utils import CursorWrapper except ImportError: from django.db.backends.util import CursorWrapper try: real_execute = CursorWrapper.execute real_executemany = CursorWrapper.executemany except AttributeError: # This won't work on Django versions < 1.6 return def execute(self, sql, params=None): # type: (CursorWrapper, Any, Optional[Any]) -> Any hub = Hub.current if hub.get_integration(DjangoIntegration) is None: return real_execute(self, sql, params) with record_sql_queries(hub, self.cursor, sql, params, paramstyle="format", executemany=False): return real_execute(self, sql, params) def executemany(self, sql, param_list): # type: (CursorWrapper, Any, List[Any]) -> Any hub = Hub.current if hub.get_integration(DjangoIntegration) is None: return real_executemany(self, sql, param_list) with record_sql_queries(hub, self.cursor, sql, param_list, paramstyle="format", executemany=True): return real_executemany(self, sql, param_list) CursorWrapper.execute = execute CursorWrapper.executemany = executemany ignore_logger("django.db.backends")
sentry_sdk.init( dsn=config.get('sentry', 'dsn'), integrations=[ PretixSentryIntegration(), CeleryIntegration(), LoggingIntegration( level=logging.INFO, event_level=logging.CRITICAL ) ], environment=SITE_URL, release=__version__, send_default_pii=False, ) ignore_logger('pretix.base.tasks') ignore_logger('django.security.DisallowedHost') setup_custom_filters() CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_TASK_DEFAULT_QUEUE = 'default' CELERY_TASK_QUEUES = ( Queue('default', routing_key='default.#'), Queue('checkout', routing_key='checkout.#'), Queue('mail', routing_key='mail.#'), Queue('background', routing_key='background.#'), Queue('notifications', routing_key='notifications.#'), ) CELERY_TASK_ROUTES = ([ ('pretix.base.services.cart.*', {'queue': 'checkout'}),