Skip to content
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

feat(sessions): only recognize session id on root span (where parent is null) #5351

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

RogerHYang
Copy link
Contributor

resolves #5347

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 13, 2024
@RogerHYang RogerHYang changed the title feat: only recognize session id on root span (where parent is null) feat(sessions): only recognize session id on root span (where parent is null) Nov 13, 2024
if span.parent_id is None:
session_id = get_attribute_value(span.attributes, SpanAttributes.SESSION_ID)
session_user = get_attribute_value(span.attributes, SpanAttributes.USER_ID)
if session_id is not None and (not isinstance(session_id, str) or session_id.strip()):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if session_id is not None and (not isinstance(session_id, str) or session_id.strip()):
if session_id is not None:

Is the second part of the conditional necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically it's possible to have "" (empty string) as the session.id, do we want to record that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Probably not would be my guess.

src/phoenix/db/insertion/span.py Show resolved Hide resolved
@RogerHYang RogerHYang merged commit 0eb4198 into sessions2 Nov 13, 2024
31 checks passed
@RogerHYang RogerHYang deleted the 5347-recognize-only-root-span branch November 13, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Done
2 participants