How do I switch from Langfuse to Rius for LlamaIndex tracing?
Rius replaces your Langfuse setup for LlamaIndex with one extra, glassflow-rius[llama-index], and one rius.init call. Query engines, retrievers, embeddings and model calls then arrive as a nested trace, with cost computed by Rius. The integration is Python only, and it is one of the integrations listed on the Integrations page.
How it works
The Rius LlamaIndex integration is an instrumentation that rius.init() turns on when llama-index is installed. You build indexes and query engines exactly as before, so you remove the Langfuse wiring and add nothing to your pipeline code.
Each query becomes a nested trace of typed spans:
- Retrieval steps are 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 are EMBEDDING spans.
- Synthesis model calls are LLM spans with model, token usage and messages. Rius computes the cost from the model and token counts, so you never send a cost value.
If the openai extra is installed too, an LLM’s chat or completion call is traced as a second LLM span under the LlamaIndex span. Since glassflow-rius 1.1.1 that call is counted once in tokens and cost, and the LlamaIndex span still shows the call’s total. Calls from MultiModalLLM models, embedding models and retrievers are not nested: their OpenAI span starts a trace of its own.
The Rius SDK leaves a library alone if other OpenTelemetry code already instruments it. Remove the Langfuse setup for LlamaIndex before you expect Rius spans for it.
Set it up
-
Create a Rius workspace and an API key. A new organization starts on a trial of 30 days or 500,000 spans, whichever comes first, with no card.
-
Remove the Langfuse setup you added for LlamaIndex, so nothing else instruments it.
-
Install the extra. It installs the instrumentation, not
llama-indexitself, which your project already has.pip install "glassflow-rius[llama-index]" llama-index -
Call
initonce at startup, then build and query your indexes as before.import rius rius.init(api_key="ri_...", service_name="my-agent") # build indexes and query engines exactly as before -
Run one query against an index and open the trace in the console. The pipeline appears as nested spans, and the LLM span carries model, tokens and cost.
-
If you also use Langfuse’s
@observedecorators or context managers around your own functions, swap them for the Rius equivalents. If your pipeline sends OpenTelemetry data to Langfuse’s endpoint, you can keep your instrumentation and re-point the exporter instead. The Migrate from Langfuse guide has the full mapping, the exporter change and a cutover checklist, and Migrate to Rius covers the other tools.
For the full integration details, see the LlamaIndex integration.
To compare both backends, run the Rius SDK in one service while others keep reporting to Langfuse, or keep OTLP instrumentation and fan out through a Collector, as the Langfuse guide shows. Compare trace counts, token totals and cost on real traffic, then cut over. Remove the Langfuse exporter or SDK and revoke its keys once nothing sends to it.
What you get
- A query trace you can read from top to bottom: retrieval, embedding and synthesis as separate spans, with the model, token counts and cost on the LLM leaf.
- Cost per call as a list-price estimate in US dollars, which Rius computes from the model and tokens.
- Sessions, and users through
user.id, which carry over from Langfuse. Set them withrius.sessionandrius.user. - Privacy controls over retrieved document content and messages, which are content attributes. Document ids and scores stay visible even with content stripped.
- Each call counted once in token and cost totals, even when the OpenAI integration also traces the call underneath LlamaIndex.
Two limits matter. There is no LlamaIndex integration in TypeScript, so LlamaIndex.TS query-engine and retriever structure is not captured. The OpenAI integration still traces the provider calls it makes, and manual generations cover the pipeline around them. Your existing traces also stay in Langfuse. Rius starts from the first span you send it.
When something else fits
- Rius has no scores, evals, datasets or prompt management. If you rely on those in Langfuse, keep them there and send traces to both tools.
- Rius is a managed service only. If you need to self-host your tracing backend, as Langfuse allows, Rius does not fit.
- If you need historical traces in the new tool, Rius does not import them, so keep Langfuse for that history.