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

deps: migration to sentry 2.2 #11650

Merged
merged 1 commit into from
May 21, 2024
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies = [
"redis>=5.0.2,<5.1.0",
"requests>=2.32.1,<2.33",
"ruamel.yaml>=0.17.2,<0.19.0",
"sentry-sdk>=1.45.0,<2.0",
"sentry-sdk>=2.2,<2.3",
"siphashc>=2.1,<3.0",
"social-auth-app-django>=5.4.0,<6.0.0",
"social-auth-core>=4.5.0,<5.0.0",
Expand Down
19 changes: 9 additions & 10 deletions weblate/utils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@
rollbar.report_exc_info(level=level)

if not skip_sentry and settings.SENTRY_DSN:
with sentry_sdk.push_scope() as scope:
scope.set_tag("cause", cause)
if project is not None:
scope.set_tag("project", project.slug)
scope.set_tag("user.locale", get_language())
scope.level = level
if message:
sentry_sdk.capture_message(cause)
else:
sentry_sdk.capture_exception()
sentry_sdk.set_tag("cause", cause)

Check warning on line 53 in weblate/utils/errors.py

View check run for this annotation

Codecov / codecov/patch

weblate/utils/errors.py#L53

Added line #L53 was not covered by tests
if project is not None:
sentry_sdk.set_tag("project", project.slug)
sentry_sdk.set_tag("user.locale", get_language())
sentry_sdk.level = level

Check warning on line 57 in weblate/utils/errors.py

View check run for this annotation

Codecov / codecov/patch

weblate/utils/errors.py#L55-L57

Added lines #L55 - L57 were not covered by tests
if message:
sentry_sdk.capture_message(cause)

Check warning on line 59 in weblate/utils/errors.py

View check run for this annotation

Codecov / codecov/patch

weblate/utils/errors.py#L59

Added line #L59 was not covered by tests
else:
sentry_sdk.capture_exception()

Check warning on line 61 in weblate/utils/errors.py

View check run for this annotation

Codecov / codecov/patch

weblate/utils/errors.py#L61

Added line #L61 was not covered by tests

log = getattr(LOGGER, level)

Expand Down
Loading