Skip to content

Commit

Permalink
Enable Sentry asyncio integration (#5685)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
agners authored Feb 28, 2025
1 parent 2274de9 commit 362bd8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion supervisor/utils/sentry.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -26,11 +28,12 @@ def init_sentry(coresys: CoreSys) -> None:
_LOGGER.info("Initializing Supervisor Sentry")
sentry_sdk.init(
dsn="https://[email protected]/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(),
Expand Down

0 comments on commit 362bd8f

Please sign in to comment.