mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-23 09:06:29 +00:00
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.
This commit is contained in:
parent
5d06ebe430
commit
c7e3d86e2d
@ -8,7 +8,6 @@ from typing import Any
|
||||
from aiohttp.web_exceptions import HTTPBadGateway, HTTPServiceUnavailable
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
|
||||
from sentry_sdk.integrations.asyncio import AsyncioIntegration
|
||||
from sentry_sdk.integrations.atexit import AtexitIntegration
|
||||
from sentry_sdk.integrations.dedupe import DedupeIntegration
|
||||
from sentry_sdk.integrations.excepthook import ExcepthookIntegration
|
||||
@ -28,6 +27,9 @@ def init_sentry(coresys: CoreSys) -> None:
|
||||
"""Initialize sentry client."""
|
||||
if not sentry_sdk.is_initialized():
|
||||
_LOGGER.info("Initializing Supervisor Sentry")
|
||||
# Don't use AsyncioIntegration(). We commonly handle task exceptions
|
||||
# outside of tasks. This would cause exception we gracefully handle to
|
||||
# be captured by sentry.
|
||||
sentry_sdk.init(
|
||||
dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612",
|
||||
before_send=partial(filter_data, coresys),
|
||||
@ -43,7 +45,6 @@ def init_sentry(coresys: CoreSys) -> None:
|
||||
}
|
||||
)
|
||||
),
|
||||
AsyncioIntegration(),
|
||||
ExcepthookIntegration(),
|
||||
DedupeIntegration(),
|
||||
AtexitIntegration(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user