-
Notifications
You must be signed in to change notification settings - Fork 557
Span data is always be a primitive data type #4643
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,8 +57,14 @@ def test_nonstreaming_chat( | |
assert span["data"][SPANDATA.AI_MODEL_ID] == "some-model" | ||
|
||
if send_default_pii and include_prompts: | ||
assert "some context" in span["data"][SPANDATA.AI_INPUT_MESSAGES][0]["content"] | ||
assert "hello" in span["data"][SPANDATA.AI_INPUT_MESSAGES][1]["content"] | ||
assert ( | ||
"{'role': 'system', 'content': 'some context'}" | ||
in span["data"][SPANDATA.AI_INPUT_MESSAGES] | ||
) | ||
assert ( | ||
"{'role': 'user', 'content': 'hello'}" | ||
in span["data"][SPANDATA.AI_INPUT_MESSAGES] | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Test Assertions Fail Due to Unstable Dictionary String RepresentationThe test assertions now depend on exact string representations of dictionaries (e.g., Locations (2) |
||
assert "the model response" in span["data"][SPANDATA.AI_RESPONSES] | ||
else: | ||
assert SPANDATA.AI_INPUT_MESSAGES not in span["data"] | ||
|
@@ -128,8 +134,14 @@ def test_streaming_chat(sentry_init, capture_events, send_default_pii, include_p | |
assert span["data"][SPANDATA.AI_MODEL_ID] == "some-model" | ||
|
||
if send_default_pii and include_prompts: | ||
assert "some context" in span["data"][SPANDATA.AI_INPUT_MESSAGES][0]["content"] | ||
assert "hello" in span["data"][SPANDATA.AI_INPUT_MESSAGES][1]["content"] | ||
assert ( | ||
"{'role': 'system', 'content': 'some context'}" | ||
in span["data"][SPANDATA.AI_INPUT_MESSAGES] | ||
) | ||
assert ( | ||
"{'role': 'user', 'content': 'hello'}" | ||
in span["data"][SPANDATA.AI_INPUT_MESSAGES] | ||
) | ||
assert "the model response" in span["data"][SPANDATA.AI_RESPONSES] | ||
else: | ||
assert SPANDATA.AI_INPUT_MESSAGES not in span["data"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unexpected Stringification of
None
and Non-Collection TypesThe
isinstance
check for primitive types(int, float, bool, str)
excludesNone
, causingNone
values to be stringified to"None"
. This is unexpected, asNone
is typically preserved as a primitive/null value. More broadly, this logic stringifies any non-primitive type, which may be overly broad if the intent was to only stringify collections (lists, tuples, dicts).Locations (1)
sentry_sdk/ai/utils.py#L32-L36