Skip to content

Commit

Permalink
[IMP] bump sentry_sdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
dnplkndll committed Jan 23, 2025
1 parent b365eef commit 1e8bc06
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dataclasses
mako
odoorpc
openupgradelib
sentry_sdk<=1.9.0
sentry_sdk>=2.0.0
2 changes: 1 addition & 1 deletion sentry/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"installable": True,
"external_dependencies": {
"python": [
"sentry_sdk<=1.9.0",
"sentry_sdk>=2.0.0",
]
},
"depends": [
Expand Down
8 changes: 6 additions & 2 deletions sentry/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def get_sentry_options():
SentryOption("dsn", "", str.strip),
SentryOption("transport", DEFAULT_OPTIONS["transport"], select_transport),
SentryOption("logging_level", DEFAULT_LOG_LEVEL, get_sentry_logging),
SentryOption("with_locals", DEFAULT_OPTIONS["with_locals"], None),
SentryOption(
"include_local_variables", DEFAULT_OPTIONS["include_local_variables"], None
),
SentryOption(
"max_breadcrumbs", DEFAULT_OPTIONS["max_breadcrumbs"], to_int_if_defined
),
Expand All @@ -107,7 +109,9 @@ def get_sentry_options():
SentryOption("http_proxy", DEFAULT_OPTIONS["http_proxy"], None),
SentryOption("https_proxy", DEFAULT_OPTIONS["https_proxy"], None),
SentryOption("ignore_exceptions", DEFAULT_IGNORED_EXCEPTIONS, split_multiple),
SentryOption("request_bodies", DEFAULT_OPTIONS["request_bodies"], None),
SentryOption(
"max_request_body_size", DEFAULT_OPTIONS["max_request_body_size"], None
),
SentryOption("attach_stacktrace", DEFAULT_OPTIONS["attach_stacktrace"], None),
SentryOption("ca_certs", DEFAULT_OPTIONS["ca_certs"], None),
SentryOption("propagate_traces", DEFAULT_OPTIONS["propagate_traces"], None),
Expand Down
2 changes: 1 addition & 1 deletion sentry/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def initialize_sentry(config):
# Patch the wsgi server in case of further registration
odoo.http.Application = SentryWsgiMiddleware(odoo.http.Application)

with sentry_sdk.push_scope() as scope:
with sentry_sdk.new_scope() as scope:
scope.set_extra("debug", False)
sentry_sdk.capture_message("Starting Odoo Server", "info")

Expand Down
7 changes: 3 additions & 4 deletions sentry/logutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os.path
import urllib.parse

from sentry_sdk._compat import text_type
from werkzeug import datastructures

from .generalutils import get_environ
Expand Down Expand Up @@ -81,7 +80,7 @@ def fetch_git_sha(path, head=None):
)

with open(head_path) as fp:
head = text_type(fp.read()).strip()
head = str(fp.read()).strip()

Check warning on line 83 in sentry/logutils.py

View check run for this annotation

Codecov / codecov/patch

sentry/logutils.py#L82-L83

Added lines #L82 - L83 were not covered by tests

if head.startswith("ref: "):
head = head[5:]
Expand Down Expand Up @@ -110,9 +109,9 @@ def fetch_git_sha(path, head=None):
except ValueError:
continue

Check warning on line 110 in sentry/logutils.py

View check run for this annotation

Codecov / codecov/patch

sentry/logutils.py#L107-L110

Added lines #L107 - L110 were not covered by tests
if ref == head:
return text_type(revision)
return str(revision)

Check warning on line 112 in sentry/logutils.py

View check run for this annotation

Codecov / codecov/patch

sentry/logutils.py#L112

Added line #L112 was not covered by tests

raise InvalidGitRepository(f"Unable to find ref to head {head} in repository")

Check warning on line 114 in sentry/logutils.py

View check run for this annotation

Codecov / codecov/patch

sentry/logutils.py#L114

Added line #L114 was not covered by tests

with open(revision_file) as fh:
return text_type(fh.read()).strip()
return str(fh.read()).strip()

Check warning on line 117 in sentry/logutils.py

View check run for this annotation

Codecov / codecov/patch

sentry/logutils.py#L116-L117

Added lines #L116 - L117 were not covered by tests
4 changes: 1 addition & 3 deletions sentry/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import re

from sentry_sdk._compat import text_type

from .generalutils import string_types, varmap


Expand Down Expand Up @@ -51,7 +49,7 @@ def sanitize(self, item, value):
if isinstance(item, bytes):
item = item.decode("utf-8", "replace")

Check warning on line 50 in sentry/processor.py

View check run for this annotation

Codecov / codecov/patch

sentry/processor.py#L50

Added line #L50 was not covered by tests
else:
item = text_type(item)
item = str(item)

item = item.lower()
for key in self.sanitize_keys:
Expand Down
9 changes: 3 additions & 6 deletions sentry/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@ def __init__(self, *args, **kwargs):
self.events = []
self.envelopes = []

def capture_event(self, event, *args, **kwargs):
self.events.append(event)

def capture_envelope(self, envelope, *args, **kwargs):
self.envelopes.append(envelope)

def has_event(self, event_level, event_msg):
for event in self.events:
for event in self.envelopes:
if (
event.get("level") == event_level
and event.get("logentry", {}).get("message") == event_msg
event.get_event().get("level") == event_level
and event.get_event().get("logentry", {}).get("message") == event_msg
):
return True
return False
Expand Down

0 comments on commit 1e8bc06

Please sign in to comment.