Users
User tracking gives you per-user visibility into token usage, costs, trace volume, and evaluation scores. This is useful for billing, abuse detection, quality monitoring, and understanding how different users interact with your application.
Adding a User ID
Set user_id via propagate_attributes() and it will automatically apply to all observations in that context:
from xeroml import observe, propagate_attributes
@observe()def handle_request(query: str, user_id: str) -> str: with propagate_attributes(user_id=user_id): result = run_pipeline(query) return resultimport { propagateAttributes } from "@xeroml/tracing";
async function handleRequest(query: string, userId: string) { return await propagateAttributes({ userId }, async () => { return await runPipeline(query); });}from xeroml.openai import openaifrom xeroml import propagate_attributes
def chat(message: str, user_id: str): with propagate_attributes(user_id=user_id): response = openai.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": message}] ) return response.choices[0].message.contentfrom xeroml import CallbackHandler, propagate_attributesfrom langchain_openai import ChatOpenAI
def chat(message: str, user_id: str): with propagate_attributes(user_id=user_id): handler = CallbackHandler() llm = ChatOpenAI(callbacks=[handler]) return llm.invoke(message).contentUser Dashboard
XeroML provides two views for user-level data:
User List A table of all users who have sent at least one trace. Columns include:
- Total traces
- Token usage (input / output / total)
- Estimated cost
- Average evaluation score
- Most recent trace timestamp
Individual User View Click any user to see their complete history: all traces, session timelines, feedback submitted, and aggregated metrics. Accessible at:
https://cloud.xeroml.com/project/{projectId}/users/{userId}Custom Dashboards
For advanced user analytics, use the XeroML Metrics API to pull per-user aggregates into your own dashboards or data warehouse. You can also export user-level data via the UI export or blob storage export.