-
Notifications
You must be signed in to change notification settings - Fork 556
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
Conversation
if isinstance(normalized, (int, float, bool, str)): | ||
span.set_data(key, normalized) | ||
else: | ||
span.set_data(key, str(normalized)) |
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 Types
The isinstance
check for primitive types (int, float, bool, str)
excludes None
, causing None
values to be stringified to "None"
. This is unexpected, as None
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)
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test Assertions Fail Due to Unstable Dictionary String Representation
The test assertions now depend on exact string representations of dictionaries (e.g., "{'role': 'system', 'content': 'some context'}"
). This is brittle because dictionary string representation can vary between Python versions and the order of keys is not guaranteed, making tests prone to false failures even if the underlying functionality is correct.
Locations (2)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4643 +/- ##
==========================================
+ Coverage 80.74% 80.75% +0.01%
==========================================
Files 156 156
Lines 16630 16632 +2
Branches 2830 2831 +1
==========================================
+ Hits 13428 13432 +4
+ Misses 2312 2311 -1
+ Partials 890 889 -1
|
The AI Agent insights module excepts the data not to be lists, tuples, or dicts. Make sure that we always send a string in this case.