Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Community] update sentrysdk version #2850

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading