From 4dbf667debda6aa4076d4bcf2fa65cbd20368b8b Mon Sep 17 00:00:00 2001 From: Rajat Ahuja Date: Wed, 15 Oct 2025 11:48:17 -0400 Subject: [PATCH] fix: add log for sentry filters for debugging --- src/sentry.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sentry.py b/src/sentry.py index e1fae034..498392f3 100644 --- a/src/sentry.py +++ b/src/sentry.py @@ -2,6 +2,7 @@ from __future__ import annotations +import logging from collections.abc import Sequence from typing import TYPE_CHECKING @@ -16,6 +17,8 @@ if TYPE_CHECKING: from sentry_sdk._types import Event, Hint from sentry_sdk.integrations import Integration +logger = logging.getLogger(__name__) + def _filter_sentry_event(event: Event, hint: Hint | None) -> Event | None: """Filter out events raised from known non-actionable exceptions before Sentry sees them.""" @@ -27,9 +30,12 @@ def _filter_sentry_event(event: Event, hint: Hint | None) -> Event | None: return event _, exc_value, _ = exc_info - if isinstance( - exc_value, HonchoException | ValidationError | RequestValidationError - ): # Filters out HonchoExceptions and ValidationErrors (typically coming from Pydantic) + if isinstance(exc_value, HonchoException): + return None + + # Filters out ValidationErrors and RequestValidationErrors (typically coming from Pydantic) + if isinstance(exc_value, ValidationError | RequestValidationError): + logger.info(f"Filtering out validation error from Sentry: {exc_value}") return None return event