Exclude non-Supervisor Server Error codes from Sentry reporting (#5718)

* Exclude non-Supervisor Server Error codes from Sentry reporting

Exclude status codes 502 Bad Gateway and 503 Service Unavailable from
Sentry aiohttp integration. These are returned by Supervisor itself
when acting as a proxy for Home Assistant Core. These aren't errors of
Supervisor.

* ruff check
This commit is contained in:
Stefan Agner 2025-03-03 23:10:59 +01:00 committed by GitHub
parent f8bab20728
commit 1355ef192d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ from functools import partial
import logging
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
@ -33,7 +34,15 @@ def init_sentry(coresys: CoreSys) -> None:
auto_enabling_integrations=False,
default_integrations=False,
integrations=[
AioHttpIntegration(),
AioHttpIntegration(
failed_request_status_codes=frozenset(range(500, 600))
- set(
{
HTTPBadGateway.status_code,
HTTPServiceUnavailable.status_code,
}
)
),
AsyncioIntegration(),
ExcepthookIntegration(),
DedupeIntegration(),