Bump sentry-sdk from 2.10.0 to 2.13.0 (#5246)

* Bump sentry-sdk from 2.10.0 to 2.13.0

Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 2.10.0 to 2.13.0.
- [Release notes](https://github.com/getsentry/sentry-python/releases)
- [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-python/compare/2.10.0...2.13.0)

---
updated-dependencies:
- dependency-name: sentry-sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Replace deprecated apis with new ones

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
This commit is contained in:
dependabot[bot] 2024-08-22 10:04:32 +02:00 committed by GitHub
parent 53fa0fe215
commit 7366673eea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 13 deletions

View File

@ -21,7 +21,7 @@ pyudev==0.24.3
PyYAML==6.0.2
requests==2.32.3
securetar==2024.2.1
sentry-sdk==2.10.0
sentry-sdk==2.13.0
setuptools==73.0.1
voluptuous==0.15.2
dbus-fast==2.23.0

View File

@ -20,14 +20,9 @@ _LOGGER: logging.Logger = logging.getLogger(__name__)
only_once_events: set[str] = set()
def sentry_connected() -> bool:
"""Is sentry connected."""
return sentry_sdk.Hub.current.client and sentry_sdk.Hub.current.client.transport
def init_sentry(coresys: CoreSys) -> None:
"""Initialize sentry client."""
if not sentry_connected():
if not sentry_sdk.is_initialized():
_LOGGER.info("Initializing Supervisor Sentry")
sentry_sdk.init(
dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612",
@ -49,7 +44,7 @@ def init_sentry(coresys: CoreSys) -> None:
def capture_event(event: dict[str, Any], only_once: str | None = None):
"""Capture an event and send to sentry."""
if sentry_connected():
if sentry_sdk.is_initialized():
if only_once and only_once not in only_once_events:
only_once_events.add(only_once)
sentry_sdk.capture_event(event)
@ -57,7 +52,7 @@ def capture_event(event: dict[str, Any], only_once: str | None = None):
def capture_exception(err: Exception) -> None:
"""Capture an exception and send to sentry."""
if sentry_connected():
if sentry_sdk.is_initialized():
sentry_sdk.capture_exception(err)
@ -66,6 +61,6 @@ def close_sentry() -> None:
This method is irreversible. A new client will have to be initialized to re-open connetion.
"""
if sentry_connected():
if sentry_sdk.is_initialized():
_LOGGER.info("Closing connection to Supervisor Sentry")
sentry_sdk.Hub.current.client.close()
sentry_sdk.get_client().close()

View File

@ -670,7 +670,7 @@ async def docker_logs(docker: DockerAPI, supervisor_name) -> MagicMock:
async def capture_exception() -> Mock:
"""Mock capture exception method for testing."""
with (
patch("supervisor.utils.sentry.sentry_connected", return_value=True),
patch("supervisor.utils.sentry.sentry_sdk.is_initialized", return_value=True),
patch(
"supervisor.utils.sentry.sentry_sdk.capture_exception"
) as capture_exception,
@ -682,7 +682,7 @@ async def capture_exception() -> Mock:
async def capture_event() -> Mock:
"""Mock capture event for testing."""
with (
patch("supervisor.utils.sentry.sentry_connected", return_value=True),
patch("supervisor.utils.sentry.sentry_sdk.is_initialized", return_value=True),
patch("supervisor.utils.sentry.sentry_sdk.capture_event") as capture_event,
):
yield capture_event