-
Notifications
You must be signed in to change notification settings - Fork 578
feat(gen_ai): add function set_conversation_id and managing functions on the Scope and apply it on the Span on .finish()
#5362
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?
Conversation
…ns on the Scope and apply it on the Span on `.finish()`
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
…same logic as in Relay
sentrivana
left a comment
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.
Nice! LGTM, see one comment
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| # Copy conversation_id from scope to span data if this is an AI span | ||
| conversation_id = scope.get_conversation_id() | ||
| if conversation_id: | ||
| has_ai_op = "gen_ai.operation.name" in self._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.
Hardcoded string used instead of existing constant
Low Severity
The code uses a hardcoded string "gen_ai.operation.name" instead of the existing constant SPANDATA.GEN_AI_OPERATION_NAME. The SPANDATA import is already present (line 8), and other integrations like anthropic.py and google_genai/__init__.py use this constant. Using the constant would be more maintainable and consistent with the rest of the codebase.
Issues
Closes https://linear.app/getsentry/issue/TET-1736/python-sdk-add-gen-aiconversationid-to-the-integrations-where-it-is