Skip to content

Commit

Permalink
[Community] update sentrysdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Jan 9, 2025
1 parent d32178e commit 663a125
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 5 additions & 15 deletions octobot/community/errors_upload/sentry_aiohttp_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import typing
import asyncio
import aiohttp
import io
import gzip

import sentry_sdk
import sentry_sdk.consts
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(
Expand All @@ -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(),
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 663a125

Please sign in to comment.