Skip to content

Commit f9face5

Browse files
authored
Merge pull request #1388 from opengisch/QF-4835-Bump_sentry_to_v2
Bump sentry to v2
2 parents ee54c7a + 77c7d8d commit f9face5

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

docker-app/qfieldcloud/core/utils2/sentry.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,35 @@ def report_serialization_diff_to_sentry(
2424
bodystream: BytesIO buffer capturing the request's raw body.
2525
capture_message: bool used as a flag by the caller to create an extra event against Sentry to attach the files to.
2626
"""
27-
with sentry_sdk.configure_scope() as scope:
28-
try:
29-
logger.info("Sending explicit sentry report!")
30-
31-
filename = f"{name}_contents.txt"
32-
scope.add_attachment(
33-
bytes=bytes(
34-
f"Pre:\n{pre_serialization}\n\nPost:{post_serialization}",
35-
encoding="utf8",
36-
),
37-
filename=filename,
38-
)
39-
40-
filename = f"{name}_traceback.txt"
41-
scope.add_attachment(
42-
bytes=bytes(buffer.getvalue(), encoding="utf8"),
43-
filename=filename,
44-
)
45-
46-
if body_stream:
47-
filename = f"{name}_rawbody.txt"
48-
scope.add_attachment(bytes=body_stream.getvalue(), filename=filename)
49-
50-
if capture_message:
51-
sentry_sdk.capture_message("Explicit Sentry report!", scope=scope)
52-
53-
return True
54-
55-
except Exception as error:
56-
logger.error(f"Unable to send file to Sentry: failed on {error}")
57-
sentry_sdk.capture_exception(error)
58-
return False
27+
scope = sentry_sdk.get_current_scope()
28+
try:
29+
logger.info("Sending explicit sentry report!")
30+
31+
filename = f"{name}_contents.txt"
32+
scope.add_attachment(
33+
bytes=bytes(
34+
f"Pre:\n{pre_serialization}\n\nPost:{post_serialization}",
35+
encoding="utf8",
36+
),
37+
filename=filename,
38+
)
39+
40+
filename = f"{name}_traceback.txt"
41+
scope.add_attachment(
42+
bytes=bytes(buffer.getvalue(), encoding="utf8"),
43+
filename=filename,
44+
)
45+
46+
if body_stream:
47+
filename = f"{name}_rawbody.txt"
48+
scope.add_attachment(bytes=body_stream.getvalue(), filename=filename)
49+
50+
if capture_message:
51+
sentry_sdk.capture_message("Explicit Sentry report!", scope=scope)
52+
53+
return True
54+
55+
except Exception as error:
56+
logger.error(f"Unable to send file to Sentry: failed on {error}")
57+
sentry_sdk.capture_exception(error)
58+
return False

docker-app/requirements/requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ phonenumbers==9.0.15
4141
Pillow==11.3.0
4242
psycopg2==2.9.11
4343
pymemcache==4.0.0
44-
sentry-sdk==1.45.1
44+
sentry-sdk==2.42.0
4545
stripe==4.2.0

docker-app/requirements/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ rpds-py==0.27.0
198198
# referencing
199199
s3transfer==0.10.4
200200
# via boto3
201-
sentry-sdk==1.45.1
201+
sentry-sdk==2.42.0
202202
# via -r /requirements/requirements.in
203203
six==1.17.0
204204
# via python-dateutil

0 commit comments

Comments
 (0)