File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
src/dstack/_internal/server Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 5858 SERVER_URL ,
5959 UPDATE_DEFAULT_PROJECT ,
6060)
61+ from dstack ._internal .server .utils import sentry_utils
6162from dstack ._internal .server .utils .logging import configure_logging
6263from dstack ._internal .server .utils .routers import (
6364 CustomORJSONResponse ,
@@ -105,6 +106,7 @@ async def lifespan(app: FastAPI):
105106 enable_tracing = True ,
106107 traces_sampler = _sentry_traces_sampler ,
107108 profiles_sample_rate = settings .SENTRY_PROFILES_SAMPLE_RATE ,
109+ before_send = sentry_utils .AsyncioCancelledErrorFilterEventProcessor (),
108110 )
109111 server_executor = ThreadPoolExecutor (max_workers = settings .SERVER_EXECUTOR_MAX_WORKERS )
110112 asyncio .get_running_loop ().set_default_executor (server_executor )
Original file line number Diff line number Diff line change 1+ import asyncio
12import functools
3+ from typing import Optional
24
35import sentry_sdk
6+ from sentry_sdk .types import Event , Hint
47
58
69def instrument_background_task (f ):
@@ -10,3 +13,12 @@ async def wrapper(*args, **kwargs):
1013 return await f (* args , ** kwargs )
1114
1215 return wrapper
16+
17+
18+ class AsyncioCancelledErrorFilterEventProcessor :
19+ # See https://docs.sentry.io/platforms/python/configuration/filtering/#filtering-error-events
20+ def __call__ (self , event : Event , hint : Hint ) -> Optional [Event ]:
21+ exc_info = hint .get ("exc_info" )
22+ if exc_info and isinstance (exc_info [1 ], asyncio .CancelledError ):
23+ return None
24+ return event
You can’t perform that action at this time.
0 commit comments