Skip to content

Commit b72b6f6

Browse files
authored
Merge branch 'master' into ep/add-git-town-github-action-8cv
2 parents ce8416b + 4f16a9e commit b72b6f6

File tree

6 files changed

+86
-3
lines changed

6 files changed

+86
-3
lines changed

CHANGELOG.md

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

3+
## 2.54.0
4+
5+
### New Features ✨
6+
7+
- Add `set_attribute`, `remove_attribute` to global API by @sentrivana in [#5555](https://github.com/getsentry/sentry-python/pull/5555)
8+
9+
### Bug Fixes 🐛
10+
11+
#### Openai
12+
13+
- Attach response model with streamed Completions API by @alexander-alderman-webb in [#5557](https://github.com/getsentry/sentry-python/pull/5557)
14+
- Attach response model with streamed Responses API by @alexander-alderman-webb in [#5554](https://github.com/getsentry/sentry-python/pull/5554)
15+
- Avoid consuming iterables passed to the Completions API by @alexander-alderman-webb in [#5489](https://github.com/getsentry/sentry-python/pull/5489)
16+
- Avoid consuming iterables passed to the Embeddings API by @alexander-alderman-webb in [#5491](https://github.com/getsentry/sentry-python/pull/5491)
17+
18+
#### Other
19+
20+
- (anthropic) Fix token accounting by @shellmayr in [#5490](https://github.com/getsentry/sentry-python/pull/5490)
21+
- (google-genai) Remove agent spans for simple requests by @alexander-alderman-webb in [#5443](https://github.com/getsentry/sentry-python/pull/5443)
22+
- (grpc) Read method from handler_call_details for grpcio >= 1.76 compat by @yeung108 in [#5521](https://github.com/getsentry/sentry-python/pull/5521)
23+
- (httpx) Correctly append baggage in async client by @sentrivana in [#5530](https://github.com/getsentry/sentry-python/pull/5530)
24+
- (pydantic-ai) Adapt to missing `ToolManager._call_tool` by @sentrivana in [#5522](https://github.com/getsentry/sentry-python/pull/5522)
25+
- (utils) Use HEROKU_BUILD_COMMIT env var for default release by @ericapisani in [#5499](https://github.com/getsentry/sentry-python/pull/5499)
26+
- (wsgi) Do not wrap file responses when uWSGI offload-threads is enabled by @ericapisani in [#5556](https://github.com/getsentry/sentry-python/pull/5556)
27+
28+
### Documentation 📚
29+
30+
- Add troubleshooting note for editable installs with uWSGI by @ericapisani in [#5552](https://github.com/getsentry/sentry-python/pull/5552)
31+
- Add debugging advice by @alexander-alderman-webb in [#5517](https://github.com/getsentry/sentry-python/pull/5517)
32+
- New integration guide by @alexander-alderman-webb in [#5476](https://github.com/getsentry/sentry-python/pull/5476)
33+
34+
### Internal Changes 🔧
35+
36+
#### Agents
37+
38+
- Add security-review skill to agent configuration by @ericapisani in [#5498](https://github.com/getsentry/sentry-python/pull/5498)
39+
- Add sentry skills to be used by warden in CI reviews by @ericapisani in [#5485](https://github.com/getsentry/sentry-python/pull/5485)
40+
41+
#### Openai
42+
43+
- Only handle streamed results when applicable by @alexander-alderman-webb in [#5553](https://github.com/getsentry/sentry-python/pull/5553)
44+
- Extract input in API-specific functions by @alexander-alderman-webb in [#5546](https://github.com/getsentry/sentry-python/pull/5546)
45+
- Separate output handling by @alexander-alderman-webb in [#5543](https://github.com/getsentry/sentry-python/pull/5543)
46+
47+
#### Openai Agents
48+
49+
- Remove `set_data_normalized` for primitive attributes by @alexander-alderman-webb in [#5509](https://github.com/getsentry/sentry-python/pull/5509)
50+
- Expect new tool fields by @alexander-alderman-webb in [#5471](https://github.com/getsentry/sentry-python/pull/5471)
51+
52+
#### Other
53+
54+
- (ai) Add configuration for dotagents by @ericapisani in [#5480](https://github.com/getsentry/sentry-python/pull/5480)
55+
- (anthropic) Remove `set_data_normalized` for primitive attributes by @alexander-alderman-webb in [#5504](https://github.com/getsentry/sentry-python/pull/5504)
56+
- (github) Add warden configuration by @ericapisani in [#5484](https://github.com/getsentry/sentry-python/pull/5484)
57+
- (pydantic-ai) Remove `set_data_normalized` for the `gen_ai.response.model` attribute by @alexander-alderman-webb in [#5512](https://github.com/getsentry/sentry-python/pull/5512)
58+
- (repo) Add .serena to .gitignore by @ericapisani in [#5464](https://github.com/getsentry/sentry-python/pull/5464)
59+
- Updated codecov.yml by @MathurAditya724 in [#5571](https://github.com/getsentry/sentry-python/pull/5571)
60+
- 🤖 Update test matrix with new releases (02/24) by @github-actions in [#5524](https://github.com/getsentry/sentry-python/pull/5524)
61+
- 🤖 Update test matrix with new releases (02/23) by @github-actions in [#5503](https://github.com/getsentry/sentry-python/pull/5503)
62+
- 🤖 Update test matrix with new releases (02/19) by @github-actions in [#5483](https://github.com/getsentry/sentry-python/pull/5483)
63+
- 🤖 Update test matrix with new releases (02/18) by @github-actions in [#5475](https://github.com/getsentry/sentry-python/pull/5475)
64+
365
## 2.53.0
466

567
### Bug Fixes 🐛

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.53.0"
34+
release = "2.54.0"
3535
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3636

3737

sentry_sdk/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,4 +1490,4 @@ def _get_default_options() -> "dict[str, Any]":
14901490
del _get_default_options
14911491

14921492

1493-
VERSION = "2.53.0"
1493+
VERSION = "2.54.0"

sentry_sdk/integrations/openai.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ def _set_streaming_completions_api_output_data(
612612
def new_iterator() -> "Iterator[ChatCompletionChunk]":
613613
nonlocal ttft
614614
for x in old_iterator:
615+
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, x.model)
616+
615617
with capture_internal_exceptions():
616618
if hasattr(x, "choices"):
617619
choice_index = 0
@@ -654,6 +656,8 @@ def new_iterator() -> "Iterator[ChatCompletionChunk]":
654656
async def new_iterator_async() -> "AsyncIterator[ChatCompletionChunk]":
655657
nonlocal ttft
656658
async for x in old_iterator:
659+
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, x.model)
660+
657661
with capture_internal_exceptions():
658662
if hasattr(x, "choices"):
659663
choice_index = 0
@@ -751,6 +755,8 @@ def new_iterator() -> "Iterator[ChatCompletionChunk]":
751755
data_buf[0].append(x.delta or "")
752756

753757
if isinstance(x, ResponseCompletedEvent):
758+
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, x.response.model)
759+
754760
_calculate_token_usage(
755761
input,
756762
x.response,
@@ -798,6 +804,8 @@ async def new_iterator_async() -> "AsyncIterator[ChatCompletionChunk]":
798804
data_buf[0].append(x.delta or "")
799805

800806
if isinstance(x, ResponseCompletedEvent):
807+
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, x.response.model)
808+
801809
_calculate_token_usage(
802810
input,
803811
x.response,

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.53.0",
24+
version="2.54.0",
2525
author="Sentry Team and Contributors",
2626
author_email="hello@sentry.io",
2727
url="https://github.com/getsentry/sentry-python",

tests/integrations/openai/test_openai.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,8 @@ def test_streaming_chat_completion_no_prompts(
511511
span = tx["spans"][0]
512512
assert span["op"] == "gen_ai.chat"
513513

514+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_MODEL] == "model-id"
515+
514516
assert SPANDATA.GEN_AI_SYSTEM_INSTRUCTIONS not in span["data"]
515517
assert SPANDATA.GEN_AI_REQUEST_MESSAGES not in span["data"]
516518
assert SPANDATA.GEN_AI_RESPONSE_TEXT not in span["data"]
@@ -656,6 +658,8 @@ def test_streaming_chat_completion(sentry_init, capture_events, messages, reques
656658
},
657659
]
658660

661+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_MODEL] == "model-id"
662+
659663
assert "hello" in span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
660664
assert "hello world" in span["data"][SPANDATA.GEN_AI_RESPONSE_TEXT]
661665

@@ -762,6 +766,8 @@ async def test_streaming_chat_completion_async_no_prompts(
762766
span = tx["spans"][0]
763767
assert span["op"] == "gen_ai.chat"
764768

769+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_MODEL] == "model-id"
770+
765771
assert SPANDATA.GEN_AI_SYSTEM_INSTRUCTIONS not in span["data"]
766772
assert SPANDATA.GEN_AI_REQUEST_MESSAGES not in span["data"]
767773
assert SPANDATA.GEN_AI_RESPONSE_TEXT not in span["data"]
@@ -897,6 +903,8 @@ async def test_streaming_chat_completion_async(
897903
span = tx["spans"][0]
898904
assert span["op"] == "gen_ai.chat"
899905

906+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_MODEL] == "model-id"
907+
900908
param_id = request.node.callspec.id
901909
if "blocks" in param_id:
902910
assert json.loads(span["data"][SPANDATA.GEN_AI_SYSTEM_INSTRUCTIONS]) == [
@@ -2445,6 +2453,7 @@ async def test_ai_client_span_streaming_responses_async_api(
24452453

24462454
expected_data = {
24472455
"gen_ai.operation.name": "responses",
2456+
"gen_ai.response.model": "response-model-id",
24482457
"gen_ai.response.streaming": True,
24492458
"gen_ai.system": "openai",
24502459
"gen_ai.response.time_to_first_token": mock.ANY,
@@ -2769,6 +2778,8 @@ def test_streaming_responses_api(
27692778
(span,) = transaction["spans"]
27702779
assert span["op"] == "gen_ai.responses"
27712780

2781+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_MODEL] == "response-model-id"
2782+
27722783
if send_default_pii and include_prompts:
27732784
assert span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES] == '["hello"]'
27742785
assert span["data"][SPANDATA.GEN_AI_RESPONSE_TEXT] == "hello world"
@@ -2824,6 +2835,8 @@ async def test_streaming_responses_api_async(
28242835
(span,) = transaction["spans"]
28252836
assert span["op"] == "gen_ai.responses"
28262837

2838+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_MODEL] == "response-model-id"
2839+
28272840
if send_default_pii and include_prompts:
28282841
assert span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES] == '["hello"]'
28292842
assert span["data"][SPANDATA.GEN_AI_RESPONSE_TEXT] == "hello world"

0 commit comments

Comments
 (0)