Skip to content

Commit

Permalink
Use a separate logger for dead links check that Sentry will ignore (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed Jul 23, 2024
1 parent 40d4c2b commit 0a63ca4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/api/utils/check_dead_links/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


logger = structlog.get_logger(__name__)

head_logger = structlog.get_logger(f"{__name__}._head")

CACHE_PREFIX = "valid:"
HEADERS = {
Expand Down Expand Up @@ -57,7 +57,7 @@ async def _head(
status = response.status
except (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_STATUS
else:
status = _TIMEOUT_STATUS
Expand Down
3 changes: 3 additions & 0 deletions api/conf/settings/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@
# 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")

0 comments on commit 0a63ca4

Please sign in to comment.