Skip to Content

How do I move my user ids from Traceloop to Rius?

Rius groups traces by users from the user.id attribute, so you set user.id on your spans instead of relying on Traceloop’s user_id association property. Keep OpenLLMetry and set user.id with the OpenTelemetry API, or switch to the Rius SDK and wrap your code in rius.user. Either way, each end user then appears on the Users page with their traces, failures, cost and time to first token.

How it works

In Traceloop, you attach a user id as an association property, for example with Traceloop.set_association_properties({"user_id": uid}). Rius has no counterpart for that call.

  • What arrives today. If you only re-point OpenLLMetry at Rius, user_id and chat_id arrive as span attributes named traceloop.association.properties.<key>. You can see them and filter on them in trace inspection, but Rius does not group by them, so no users appear.
  • What Rius reads. Users come from user.id (or enduser.id). OpenLLMetry does not set either one. Rius lists each trace under the user of its root span, the top-level span of the trace.
  • No user id. A trace with no user.id counts as anonymous.
  • Sessions are separate. Traceloop conversation ids (chat_id is not one) already become Rius sessions, because OpenLLMetry writes gen_ai.conversation.id, which Rius reads as the session. Only the user id needs new code.

The Traceloop migration guide maps the rest of the concepts, and Migrate to Rius covers the other tools.

Set it up

  1. Point your traces at Rius. Keep OpenLLMetry and change its export settings, or move to the Rius SDK. The Traceloop migration guide has both paths in full. For OpenLLMetry the core change is the base URL and the auth header, plus turning off OpenLLMetry metrics in Python, since Rius ingests traces only:

    export TRACELOOP_BASE_URL="https://ingest.eu.console.rius-glassflow.com" export TRACELOOP_HEADERS="Authorization=Bearer%20<your Rius API key>" export TRACELOOP_METRICS_ENABLED="false" # Python SDK only
  2. If you keep OpenLLMetry, set user.id yourself. Call this inside your outermost decorated function, the @workflow or @agent that starts the trace, so the root span carries it:

    from opentelemetry import trace trace.get_current_span().set_attribute("user.id", user_id)

    Set it on the other spans of the trace too where you can. Then you can stop calling set_association_properties for the user id, unless you still want the old attribute for filtering.

  3. If you move to the Rius SDK, use rius.user. It replaces the association property call and stamps user.id on every span in its scope, root included:

    import rius rius.init(service_name="my-agent") # reads RIUS_API_KEY with rius.user(user_id): ... # run your agent here

    In TypeScript the equivalent is withUser. Remove OpenLLMetry when you add the Rius SDK, because running both produces duplicate LLM spans.

  4. Open the scope before the trace starts. Enter rius.user around the call that begins the run, so the root span has the id.

  5. Pass an opaque id. Use an internal user id rather than an email address. Rius has no environment variable for the user, by design, so it always comes from your code.

  6. Check one request. Send a traced request, then open the Users page and confirm the user appears with that trace.

What you get

  • Each end user appears on the Users page with their traces, failures, cost and time to first token.
  • Rius computes cost on the server from the model and token counts, so each user’s spend needs nothing extra from you.
  • Conversation ids keep working as sessions with no change.
  • Your old traceloop.association.properties.* attributes stay visible on spans in trace inspection while you migrate.
  • You can send the same traces to Traceloop and Rius through a Collector while you compare, as the Traceloop migration guide shows.

When something else fits

  • If you only need to filter traces by a custom property such as chat_id, the attribute that arrives from OpenLLMetry already works for that, and no user mapping is needed.
  • Past traces and their user ids stay in Traceloop. Rius starts from the first span you send, so keep Traceloop running alongside Rius for any historical user analysis.

Still stuck? Get help

Last updated on