feat(core): Add scope-level conversation ID API to support linking AI conversations#18909
Conversation
size-limit report 📦
|
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
Lms24
left a comment
There was a problem hiding this comment.
Thanks for making the changes! LGTM now!
In the future, we also might want to export conversationIdIntegration from SDKs but as long as there's nothing to configure, I think it's fine to leave it unexported. Happy to leave that up to you :)
…rysetconversationid-api
…rysetconversationid-api
There was a problem hiding this comment.
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.
|
|
||
| if (conversationId) { | ||
| span.setAttribute(GEN_AI_CONVERSATION_ID_ATTRIBUTE, conversationId); | ||
| } |
There was a problem hiding this comment.
Integration uses spanStart instead of agreed spanEnd hook
High Severity
The integration uses client.on('spanStart', ...) but the PR discussion explicitly agreed on client.on('spanEnd', ...). With spanStart, the scope's conversation ID is set first, then auto-detected values from OpenAI/LangGraph integrations override it during span execution. The PR description states scope-level values should "override any automatically detected value" which requires spanEnd so the scope value is applied last and takes precedence.
Introduces a new
Sentry.setConversationId()API to track multi turn AI conversations across API calls.Why not just add this as an attribute?
it should only appear as a span attribute, not propagate to logs and metrics. This keeps AI conversation context isolated to spans where it's semantically relevant.