Sessions & users

Stitch multi-turn conversations into one timeline and slice every metric by end user with session and user ids.

One conversation is many traces. Pass a session id to stitch every turn into a single thread, and a user id to slice your data by the people actually using your product. Add tags to filter by feature, environment, or experiment.

Group by session and user

Set sessionId / userId (and optionally tags) when you create the trace:

const trace = currai.trace({
  name: "chat-turn",
  sessionId: "sess-42",
  userId: "user-1",
  tags: ["chatbot", "production"],
});

// every turn sharing sess-42 is stitched into one conversation view
await currai.flushAsync();
trace = currai.trace(
    name="chat-turn",
    session_id="sess-42",
    user_id="user-1",
    tags=["chatbot", "production"],
)

await currai.flush_async()

What this gives you

  • Sessions — every trace sharing a sessionId is grouped into one replayable conversation timeline, with its own rolled-up trace count and cost.
  • Users — filter every metric (cost, latency, volume) by userId, and spot your heaviest users and most expensive conversations.
  • Tags — label traces by environment, feature, or experiment for fast filtering.

Choosing ids

  • Use a stable userId — your app's user identifier, not a per-request value — so a user's traces aggregate over time.
  • Use one sessionId per conversation or thread; reuse it across every turn that belongs together.

Next: send data with OpenTelemetry.