Skip to content

Commit 5cc512f

Browse files
committed
Merge branch 'master' into antonpirker/openai-overhaul
2 parents f0b3d95 + c1c6e0b commit 5cc512f

File tree

15 files changed

+106
-131
lines changed

15 files changed

+106
-131
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 2.33.2
4+
5+
### Various fixes & improvements
6+
7+
- ref(spotlight): Do not import `sentry_sdk.spotlight` unless enabled (#4607) by @sentrivana
8+
- ref(gnu-integration): update clickhouse stacktrace parsing (#4598) by @MeredithAnya
9+
310
## 2.33.1
411

512
### Various fixes & improvements

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
3232
author = "Sentry Team and Contributors"
3333

34-
release = "2.33.1"
34+
release = "2.33.2"
3535
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3636

3737

scripts/populate_tox/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"deps": {
145145
"*": ["pytest-asyncio"],
146146
},
147+
"python": ">=3.10",
147148
},
148149
"openfeature": {
149150
"package": "openfeature-sdk",

sentry_sdk/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
)
4848
from sentry_sdk.scrubber import EventScrubber
4949
from sentry_sdk.monitor import Monitor
50-
from sentry_sdk.spotlight import setup_spotlight
5150

5251
if TYPE_CHECKING:
5352
from typing import Any
@@ -429,6 +428,10 @@ def _capture_envelope(envelope):
429428
)
430429

431430
if self.options.get("spotlight"):
431+
# This is intentionally here to prevent setting up spotlight
432+
# stuff we don't need unless spotlight is explicitly enabled
433+
from sentry_sdk.spotlight import setup_spotlight
434+
432435
self.spotlight = setup_spotlight(self.options)
433436
if not self.options["dsn"]:
434437
sample_all = lambda *_args, **_kwargs: 1.0

sentry_sdk/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,4 +1187,4 @@ def _get_default_options():
11871187
del _get_default_options
11881188

11891189

1190-
VERSION = "2.33.1"
1190+
VERSION = "2.33.2"

sentry_sdk/integrations/gnu_backtrace.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,12 @@
1212
from sentry_sdk._types import Event
1313

1414

15-
MODULE_RE = r"[a-zA-Z0-9/._:\\-]+"
16-
TYPE_RE = r"[a-zA-Z0-9._:<>,-]+"
17-
HEXVAL_RE = r"[A-Fa-f0-9]+"
18-
15+
FUNCTION_RE = r"[^@]+?)\s+@\s+0x[0-9a-fA-F]+"
1916

2017
FRAME_RE = r"""
21-
^(?P<index>\d+)\.\s
22-
(?P<package>{MODULE_RE})\(
23-
(?P<retval>{TYPE_RE}\ )?
24-
((?P<function>{TYPE_RE})
25-
(?P<args>\(.*\))?
26-
)?
27-
((?P<constoffset>\ const)?\+0x(?P<offset>{HEXVAL_RE}))?
28-
\)\s
29-
\[0x(?P<retaddr>{HEXVAL_RE})\]$
18+
^(?P<index>\d+)\.\s+(?P<function>{FUNCTION_RE}\s+in\s+(?P<package>.+)$
3019
""".format(
31-
MODULE_RE=MODULE_RE, HEXVAL_RE=HEXVAL_RE, TYPE_RE=TYPE_RE
20+
FUNCTION_RE=FUNCTION_RE,
3221
)
3322

3423
FRAME_RE = re.compile(FRAME_RE, re.MULTILINE | re.VERBOSE)

sentry_sdk/integrations/threading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _run_old_run_func():
120120
# type: () -> Any
121121
try:
122122
self = current_thread()
123-
return old_run_func(self, *a, **kw)
123+
return old_run_func(self, *a[1:], **kw)
124124
except Exception:
125125
reraise(*_capture_exception())
126126

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_file_text(file_name):
2121

2222
setup(
2323
name="sentry-sdk",
24-
version="2.33.1",
24+
version="2.33.2",
2525
author="Sentry Team and Contributors",
2626
author_email="[email protected]",
2727
url="https://github.com/getsentry/sentry-python",

tests/integrations/aiohttp/test_aiohttp.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import pytest
88

9-
from aiohttp import web, ClientSession
9+
from aiohttp import web
1010
from aiohttp.client import ServerDisconnectedError
1111
from aiohttp.web_request import Request
1212
from aiohttp.web_exceptions import (
@@ -636,6 +636,7 @@ async def handler(request):
636636
@pytest.mark.asyncio
637637
async def test_span_origin(
638638
sentry_init,
639+
aiohttp_raw_server,
639640
aiohttp_client,
640641
capture_events,
641642
):
@@ -644,10 +645,16 @@ async def test_span_origin(
644645
traces_sample_rate=1.0,
645646
)
646647

648+
# server for making span request
649+
async def handler(request):
650+
return web.Response(text="OK")
651+
652+
raw_server = await aiohttp_raw_server(handler)
653+
647654
async def hello(request):
648-
async with ClientSession() as session:
649-
async with session.get("http://example.com"):
650-
return web.Response(text="hello")
655+
span_client = await aiohttp_client(raw_server)
656+
await span_client.get("/")
657+
return web.Response(text="hello")
651658

652659
app = web.Application()
653660
app.router.add_get(r"/", hello)

tests/integrations/huggingface_hub/test_huggingface_hub.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
def mock_client_post(client, post_mock):
1616
# huggingface-hub==0.28.0 deprecates the `post` method
1717
# so patch `_inner_post` instead
18-
client.post = post_mock
19-
client._inner_post = post_mock
18+
if hasattr(client, "post"):
19+
client.post = post_mock
20+
if hasattr(client, "_inner_post"):
21+
client._inner_post = post_mock
2022

2123

2224
@pytest.mark.parametrize(
@@ -33,7 +35,8 @@ def test_nonstreaming_chat_completion(
3335
)
3436
events = capture_events()
3537

36-
client = InferenceClient()
38+
client = InferenceClient(model="https://")
39+
3740
if details_arg:
3841
post_mock = mock.Mock(
3942
return_value=b"""[{
@@ -92,7 +95,7 @@ def test_streaming_chat_completion(
9295
)
9396
events = capture_events()
9497

95-
client = InferenceClient()
98+
client = InferenceClient(model="https://")
9699

97100
post_mock = mock.Mock(
98101
return_value=[
@@ -141,7 +144,7 @@ def test_bad_chat_completion(sentry_init, capture_events):
141144
sentry_init(integrations=[HuggingfaceHubIntegration()], traces_sample_rate=1.0)
142145
events = capture_events()
143146

144-
client = InferenceClient()
147+
client = InferenceClient(model="https://")
145148
post_mock = mock.Mock(side_effect=OverloadedError("The server is overloaded"))
146149
mock_client_post(client, post_mock)
147150

@@ -159,7 +162,7 @@ def test_span_origin(sentry_init, capture_events):
159162
)
160163
events = capture_events()
161164

162-
client = InferenceClient()
165+
client = InferenceClient(model="https://")
163166
post_mock = mock.Mock(
164167
return_value=[
165168
b"""data:{

0 commit comments

Comments
 (0)