Skip to content

Commit c7e3d86

Browse files
authoredMar 5, 2025··
Revert "Enable Sentry asyncio integration (#5685)" (#5729)
This essentially reverts PR #5685. The Sentry `AsyncioIntegration` replaces the asyncio task factory with its instrumentalized version, which reports all execeptions which aren't handled *within* a task to Sentry. However, we quite often run tasks and handle exceptions outside, e.g. this commen pattern (example from `MountManager` `reload()``): ```python results = await asyncio.gather( *[mount.update() for mount in mounts], return_exceptions=True ) ... create resolution issues from results with exceptions ... ``` Here, asyncio.gather() uses ensure_future(), which converts the co-routines to tasks. These Sentry instrumented tasks will then report exceptions to Sentry, even though we handle exceptions gracefully. So the `AsyncioIntegration` doesn't work for our use case, and causes unnecessary noise in Sentry. Disable it again.
1 parent 5d06ebe commit c7e3d86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎supervisor/utils/sentry.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from aiohttp.web_exceptions import HTTPBadGateway, HTTPServiceUnavailable
99
import sentry_sdk
1010
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
11-
from sentry_sdk.integrations.asyncio import AsyncioIntegration
1211
from sentry_sdk.integrations.atexit import AtexitIntegration
1312
from sentry_sdk.integrations.dedupe import DedupeIntegration
1413
from sentry_sdk.integrations.excepthook import ExcepthookIntegration
@@ -28,6 +27,9 @@ def init_sentry(coresys: CoreSys) -> None:
2827
"""Initialize sentry client."""
2928
if not sentry_sdk.is_initialized():
3029
_LOGGER.info("Initializing Supervisor Sentry")
30+
# Don't use AsyncioIntegration(). We commonly handle task exceptions
31+
# outside of tasks. This would cause exception we gracefully handle to
32+
# be captured by sentry.
3133
sentry_sdk.init(
3234
dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612",
3335
before_send=partial(filter_data, coresys),
@@ -43,7 +45,6 @@ def init_sentry(coresys: CoreSys) -> None:
4345
}
4446
)
4547
),
46-
AsyncioIntegration(),
4748
ExcepthookIntegration(),
4849
DedupeIntegration(),
4950
AtexitIntegration(),

0 commit comments

Comments
 (0)
Please sign in to comment.