From 663a125875f8683b66b06c44138d2596638794c3 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Thu, 9 Jan 2025 11:42:47 +0100 Subject: [PATCH] [Community] update sentrysdk version --- .../errors_upload/sentry_aiohttp_transport.py | 20 +++++-------------- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/octobot/community/errors_upload/sentry_aiohttp_transport.py b/octobot/community/errors_upload/sentry_aiohttp_transport.py index 1a77a4db9..0f8f50ca2 100644 --- a/octobot/community/errors_upload/sentry_aiohttp_transport.py +++ b/octobot/community/errors_upload/sentry_aiohttp_transport.py @@ -17,8 +17,6 @@ import typing import asyncio import aiohttp -import io -import gzip import sentry_sdk import sentry_sdk.consts @@ -75,7 +73,7 @@ def record_loss(reason: str) -> None: pass elif response.status >= 300 or response.status < 200: - sentry_sdk.utils.logger.error( + logging.getLogger(self.__class__.__name__).warning( "Unexpected status code: %s (body: %s)", response.status, await response.text(), @@ -121,14 +119,7 @@ async def _async_send_envelope( if client_report_item is not None: envelope.items.append(client_report_item) - body = io.BytesIO() - if self._compresslevel == 0: - envelope.serialize_into(body) - else: - with gzip.GzipFile( - fileobj=body, mode="w", compresslevel=self._compresslevel - ) as f: - envelope.serialize_into(f) + content_encoding, body = self._serialize_envelope(envelope) assert self.parsed_dsn is not None sentry_sdk.utils.logger.debug( @@ -141,8 +132,8 @@ async def _async_send_envelope( headers = { "Content-Type": "application/x-sentry-envelope", } - if self._compresslevel > 0: - headers["Content-Encoding"] = "gzip" + if content_encoding: + headers["Content-Encoding"] = content_encoding await self._async_send_request( body.getvalue(), @@ -225,8 +216,7 @@ def full(self) -> bool: return len(self.call_tasks) > self._queue_size def flush(self, timeout: float, callback=None) -> None: - sentry_sdk.utils.logger.debug("background worker got flush request") - sentry_sdk.utils.logger.debug("background worker flush ignored") + sentry_sdk.utils.logger.debug("Custom background worker got flush request, ignored") async def _async_call(self, callback): try: diff --git a/requirements.txt b/requirements.txt index 476a90d05..091481fb7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ gmqtt==0.7.0 pgpy==0.6.0 # Error tracking -sentry-sdk==2.13.0 # always make sure sentry_aiohttp_transport.py keep working +sentry-sdk==2.19.2 # always make sure sentry_aiohttp_transport.py keep working # Supabase ensure supabase_backend_tests keep passing when updating any of those supabase==2.11.0 # Supabase client