Use this file to discover all available pages before exploring further.
By default, Openlayer treats each request as a standalone trace.
With users and sessions, you can connect those traces into journeys —
making it easier to see how people interact with your system across time.A session represents a series of related interactions (e.g., a multi-turn chatbot conversation).
While a user is the individual behind one or more sessions, identified by an ID.In the Openlayer UI, you can filter and group traces by session_id or user_id to:
Inspect full conversation threads.
Track user journeys end-to-end.
Identify problematic patterns tied to specific users or flows.
Set the context once (e.g., in middleware) and all traces
created in that request will inherit it.
from openlayer.lib import set_user_session_context, clear_user_session_context# In your middleware or request handlerdef handle_request(request): # Extract user and session from your authentication system user_id = get_user_id_from_request(request) session_id = get_session_id_from_request(request) # Set default context for all traces in this request set_user_session_context(user_id=user_id, session_id=session_id) try: # Your application logic with traced functions result = process_user_request(request.data) return result finally: # Clean up context when request is complete clear_user_session_context()