Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Use a separate logger for dead links check that Sentry will ignore (#4649)
Dhruv Bhanushali0a63ca46ed3d
diff --git a/api/api/utils/check_dead_links/__init__.py b/api/api/utils/check_dead_links/__init__.pyindex f9abc9de4..ef602d5b6 100644--- a/api/api/utils/check_dead_links/__init__.py+++ b/api/api/utils/check_dead_links/__init__.py@@ -17,7 +17,7 @@ from api.utils.dead_link_mask import get_query_mask, save_query_masklogger = structlog.get_logger(__name__)-+head_logger = structlog.get_logger(f"{__name__}._head")CACHE_PREFIX = "valid:"HEADERS = {@@ -57,7 +57,7 @@ async def _head(status = response.statusexcept (aiohttp.ClientError, asyncio.TimeoutError) as exception:if not isinstance(exception, asyncio.TimeoutError):- logger.error("dead_link_validation_error", e=exception)+ head_logger.error("dead_link_validation_error", e=exception)status = _ERROR_STATUSelse:status = _TIMEOUT_STATUSdiff --git a/api/conf/settings/sentry.py b/api/conf/settings/sentry.pyindex 641307861..428eb6dee 100644--- a/api/conf/settings/sentry.py+++ b/api/conf/settings/sentry.py@@ -30,3 +30,6 @@ if not DEBUG and SENTRY_DSN:# code, which can be registered by Sentry and obscure the underlying reason# why 5xx response was returned in the first place.ignore_logger("django_structlog.middlewares.request")+ # These errors can occur in large volumes and so we don't want them to fill+ # up in Sentry and overwhelm us with Slack notifications.+ ignore_logger("api.utils.check_dead_links._head")