fix(sentry): Add sentry filtering stop gap (#3185)

This commit is contained in:
Kian Jones
2025-07-07 09:39:59 -07:00
committed by GitHub
parent 3b6c4557cc
commit 0ff12fdb44

View File

@@ -160,6 +160,17 @@ async def lifespan(app_: FastAPI):
logger.info(f"[Worker {worker_id}] Lifespan shutdown completed")
# TODO: Make this more robust
def filter_out_sentry_errors(event, hint):
if (
"Fiel processing Failed" in str(event.get("exception"))
or "Failed to embed batch of size 32" in str(event.get("exception"))
or "`inputs` must have less than 512 tokens" in str(event.get("exception"))
):
return None
return event
def create_application() -> "FastAPI":
"""the application start routine"""
# global server
@@ -175,6 +186,7 @@ def create_application() -> "FastAPI":
_experiments={
"continuous_profiling_auto_start": True,
},
before_send=filter_out_sentry_errors,
)
debug_mode = "--debug" in sys.argv