Hello! I've been struggling with this unexpected (for me) behavior of sessions. Phoenix likely treats session_id as a globally unique identifier across all projects. When I send: - Request 1: project_name="test-session-level-0", session_id="session-0" → Creates session "session-0" under "test-session-level-0" - Request 2: project_name="test-session-level-1", session_id="session-0" → Finds existing session "session-0" and adds to it (inside the project of the request 1) The trace goes to the correct project, but the session grouping happens globally based on session_id. Anyone can help me here? is this the way it's designed to work?
💡 Hint: Mention RunLLM in the thread for followups.
Yes, Sessions tab is what I meant, I attached screenshot of what's happening: Request 1: project_name="test-session-level-0", session_id="session-0" → Creates session "session-0"
Then I send the second request with: Request 2: project_name="test-session-level-1", session_id="session-0" → Finds existing session "session-0" and adds to it As you can see, no sessions created under the project of the "request 2"
Because the traces of the request 2 are correctly stored under the "test-session-level-1" but the messages of the "session-0" went under the first project
🔒[private user] If you need more info just tell me
Can you show me the code?
Exactly that
It's a FastAPI application where I had to use ContextVar to redirect the traces to the project_name specified in the client request, using autotracing with Langgraph and wraping the ReadeableSpan with a ProjectRoutingSpanWrapper to set the Resource with the "scope request" project name
So it's difficult to share with you the implementation sorry
No worries. What makes you want to separate the traces for a single session into distinct projects?
We have an assumption in our data model that a session belongs to exactly one project, which is the project associated with the first trace of the session that Phoenix receives. We assumed when building this feature that session IDs would contain a random element to them (so collisions are unlikely) and that users would typically send the traces from the same session to a single project. https://github.com/Arize-ai/phoenix/blob/main/src/phoenix/db/README.md#core-tracing--projects
What makes you want to separate the traces for a single session into distinct projects? -> This is what I don't want to, what I try to avoid
I understand your point, but even collisions are unlikely it could happen if the session_ids are not randomly generated...
