From 362bd8fd2114b08fc6f56395381a3dd568a7e8f5 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 28 Feb 2025 09:57:11 +0100 Subject: [PATCH] Enable Sentry asyncio integration (#5685) Enable the Sentry asyncio integration. This makes sure that exception in non-awaited tasks get reported to sentry. While at it, use partial instead of lambda for the filter function. --- supervisor/utils/sentry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/supervisor/utils/sentry.py b/supervisor/utils/sentry.py index 5e1ca2d54..da6fa0190 100644 --- a/supervisor/utils/sentry.py +++ b/supervisor/utils/sentry.py @@ -1,10 +1,12 @@ """Utilities for sentry.""" +from functools import partial import logging from typing import Any 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 @@ -26,11 +28,12 @@ def init_sentry(coresys: CoreSys) -> None: _LOGGER.info("Initializing Supervisor Sentry") sentry_sdk.init( dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612", - before_send=lambda event, hint: filter_data(coresys, event, hint), + before_send=partial(filter_data, coresys), auto_enabling_integrations=False, default_integrations=False, integrations=[ AioHttpIntegration(), + AsyncioIntegration(), ExcepthookIntegration(), DedupeIntegration(), AtexitIntegration(),