How do I switch from Traceloop to Rius for LlamaIndex?
To switch from Traceloop to Rius for LlamaIndex, swap OpenLLMetry for the Rius SDK’s llama-index integration, which traces queries, retrievers, embeddings and model calls. Install one extra, replace the Traceloop init call with rius.init(), and your queries arrive as nested spans with model, tokens and cost. Your existing LlamaIndex code does not change.
How it works
Traceloop’s SDK is OpenLLMetry, which is plain OpenTelemetry. You have two ways to move to Rius, described in the Traceloop migration guide. This article covers the one that replaces the setup: the Rius SDK with its LlamaIndex integration.
- The Rius SDK turns on the LlamaIndex integration when you call
init()and thellama-indexextra is installed. Rius integrations are Python only for LlamaIndex. - Rius computes cost from the model and token counts on the spans. You never send a cost value.
- Run either OpenLLMetry or the Rius SDK in a process, not both. They instrument the same client libraries with different instrumentors, so running both produces duplicate LLM spans.
The other way is to keep OpenLLMetry and change only where it exports. That is covered under when something else fits, below.
Set it up
-
Remove OpenLLMetry from the process. Delete the
Traceloop.init()call and theTRACELOOP_*variables from your deployment, such asTRACELOOP_API_KEY. Take OpenLLMetry’s packages out of the dependencies of the services you move. -
Install the Rius SDK with the LlamaIndex extra. The extra installs the instrumentation, not
llama-indexitself, so the package is named here for a fresh environment. A project that already uses LlamaIndex has it.pip install "glassflow-rius[llama-index]" llama-index -
Call
init()where you calledTraceloop.init(). Build your indexes and query engines exactly as before.import rius rius.init(api_key="ri_...", service_name="my-agent") # build indexes and query engines exactly as beforeservice_nameplays the roleapp_namehad in Traceloop: it names the agent your traces are grouped under. If you do not passapi_key, the SDK readsRIUS_API_KEY. -
Map any OpenLLMetry decorators you wrapped around your pipeline. They become
observewrappers:@workflowand@taskbecome@rius.observe(name=...), which makes a generic step.@agentbecomes@rius.observe(kind=SpanKind.AGENT, agent_name=...).@toolbecomes@rius.observe(kind=SpanKind.TOOL, tool_name=...). Give a tool function you trace yourself the TOOL kind, because a bareobservemakes a generic step.@conversationandset_conversation_idbecomewith rius.session(cid):.- Association properties such as
user_idbecomewith rius.user(uid):, which setsuser.idon every span in scope.
-
Verify. Run one query against an index and open the trace in the console. You should see the pipeline as nested spans, with the model call at the leaf carrying model, tokens and cost. The LlamaIndex integration page lists what is captured.
If you also installed the openai extra, a chat or completion call is traced as a second LLM span under the LlamaIndex span. With glassflow-rius 1.1.1 or later it is still counted once in tokens and cost.
What you get
After the switch, a LlamaIndex query is a nested trace of typed spans:
- Retrieval steps appear as retriever spans. The retriever span’s output shows what the model was given to work with, which is where RAG debugging usually starts.
- Embedding calls appear as embedding spans.
- Synthesis model calls appear as LLM spans with model, token usage and messages, and cost computed by Rius in US dollars. Costs are list-price estimates from LiteLLM’s public model-price catalog.
- Your own wrappers appear with the kinds you gave them: agent, tool or generic step. Span names follow the GenAI conventions, so an unnamed agent or tool span is called
invoke_agentorexecute_toolfollowed by its name, rather than OpenLLMetry’sname.agentandname.tool. Update saved searches that match on span names. - Sessions and users from
rius.sessionandrius.user.
Calls from MultiModalLLM models, embedding models and retrievers are not nested under the LlamaIndex span when the openai extra is also installed. Their OpenAI span starts a trace of its own.
Retrieved document content and messages are content attributes, so the privacy controls cover them. Document ids and scores stay visible even with content stripped.
Traces start from the first span you send. Existing traces stay in Traceloop.
When something else fits
- You want to keep OpenLLMetry and its decorators unchanged. Change its export base URL and auth header to point at Rius instead. In Python this switches off Traceloop’s platform features such as
get_prompt(), so use a Collector fan-out if you rely on them. Both options are in the Traceloop migration guide, and Migrate to Rius covers the general case. - You use evaluators, guardrails, a prompt registry, datasets or experiments. Rius does not offer them, so keep those workflows in Traceloop and send traces to both while you compare.
- Your LlamaIndex code is TypeScript. There is no LlamaIndex integration for TypeScript, so query-engine and retriever structure is not captured for LlamaIndex.TS.