-
Notifications
You must be signed in to change notification settings - Fork 584
ref(google-genai): Remove set_data_normalized for the gen_ai.response.finish_reasons attribute
#5506
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
base: master
Are you sure you want to change the base?
ref(google-genai): Remove set_data_normalized for the gen_ai.response.finish_reasons attribute
#5506
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 |
|---|---|---|
|
|
@@ -881,8 +881,8 @@ def set_span_data_for_response( | |
|
|
||
| finish_reasons = extract_finish_reasons(response) | ||
| if finish_reasons: | ||
| set_data_normalized( | ||
| span, SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS, finish_reasons | ||
| span.set_data( | ||
| SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS, json.dumps(finish_reasons) | ||
| ) | ||
|
Comment on lines
+884
to
886
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: Using Suggested FixRevert to using Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
Contributor
Author
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. The aim is to have a consistent type for an attribute, so if lists are possible they should always be lists. |
||
|
|
||
| if getattr(response, "response_id", None): | ||
|
|
||
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.
Inconsistent finish_reasons format between streaming and non-streaming
High Severity
The change creates inconsistent serialization for
gen_ai.response.finish_reasonsbetween streaming and non-streaming paths. Non-streaming now always stores as JSON array (e.g.,'["STOP"]'), while streaming still usesset_data_normalizedwhich unpacks single-element lists to plain strings (e.g.,"STOP"). OpenTelemetry specifies this attribute asstring[]type, requiring consistent array format. Consumers parsing this attribute will encounter different formats depending on whether streaming was used, breaking data consistency.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.
The aim is to have a consistent type for an attribute, so if lists are possible they should always be lists.