Tracing
Observability & Tracing with Langfuse.
This document is contributed by our community contributor jannikmaierhoefer. 👏
RAGFlow includes a Langfuse integration for recording chat traces and chat-model generation observations.
- A Langfuse workspace, either cloud-hosted or self-hosted, with a Project Public Key and Secret Key.
1. Collect Your Langfuse Credentials
- Sign in to your Langfuse dashboard.
- Open Settings ▸ Projects and either create a new project or select an existing one.
- Copy the Public Key and Secret Key.
- Note the Langfuse host (e.g.
https://cloud.langfuse.com). Use the base URL of your own installation if you self-host.
The keys are project-scoped: one pair of keys is enough for all environments that should write into the same project.
2. Add the Keys to RAGFlow
RAGFlow stores the credentials per tenant. You can configure them either via the web UI or the HTTP API.
- Log in to RAGFlow and click your avatar in the top-right corner.
- Select API ▸ Scroll down to the bottom ▸ Langfuse Configuration.
- Fill in your Langfuse Host, Public Key, and Secret Key.
- Click Save.
Once saved, the Go chat pipeline uses these credentials for chat requests that use a knowledge base or web search.
3. Run a Pipeline and Watch the Traces
- Send a message through a Chat configured with a knowledge base or web search.
- Open your Langfuse project ▸ Traces.
- Find the trace named
openai_chatfor the request.
The trace contains:
- One
openai_chattrace containing the tenant ID asuserId, the chat ID assessionId, and metadata indicating whether streaming was enabled and how many knowledge bases were configured. - One
chatgeneration observation containing the model name and the prompt, citation prompt, and model message list as input. - A completion update for that generation containing the recorded output summary and prompt, completion, and total token counts.
Langfuse delivery runs asynchronously, so a tracing delivery failure does not stop the chat response.
Use the recorded generation input, output, model name, and token usage to inspect a traced chat request.