您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. sidebar_position: 9
  3. slug: /tracing
  4. ---
  5. # Observability & Tracing with Langfuse
  6. RAGFlow ships with a built-in [Langfuse](https://langfuse.com) integration so that you can **inspect and debug every retrieval and generation step** of your RAG pipelines in near real-time.
  7. Langfuse stores traces, spans and prompt payloads in a purpose-built observability backend and offers filtering and visualisations on top.
  8. :::info NOTE
  9. • RAGFlow **≥ 0.18.0** (contains the Langfuse connector)
  10. • A Langfuse workspace (cloud or self-hosted) with a _Project Public Key_ and _Secret Key_
  11. :::
  12. ---
  13. ## 1. Collect your Langfuse credentials
  14. 1. Sign in to your Langfuse dashboard.
  15. 2. Open **Settings ▸ Projects** and either create a new project or select an existing one.
  16. 3. Copy the **Public Key** and **Secret Key**.
  17. 4. Note the Langfuse **host** (e.g. `https://cloud.langfuse.com`). Use the base URL of your own installation if you self-host.
  18. > The keys are _project-scoped_: one pair of keys is enough for all environments that should write into the same project.
  19. ---
  20. ## 2. Add the keys to RAGFlow
  21. RAGFlow stores the credentials _per tenant_. You can configure them either via the web UI or the HTTP API.
  22. 1. Log in to RAGFlow and click your avatar in the top-right corner.
  23. 2. Select **API ▸ Scroll down to the bottom ▸ Langfuse Configuration**.
  24. 3. Fill in you Langfuse **Host**, **Public Key** and **Secret Key**.
  25. 4. Click **Save**.
  26. ![Example Ragflow trace in Langfuse](https://langfuse.com/images/docs/ragflow/ragflow-configuration.gif)
  27. Once saved, RAGFlow starts emitting traces automatically – no code change required.
  28. ---
  29. ## 3. Run a pipeline and watch the traces
  30. 1. Execute any chat or retrieval pipeline in RAGFlow (e.g. the Quickstart demo).
  31. 2. Open your Langfuse project ▸ **Traces**.
  32. 3. Filter by **name ~ `ragflow-*`** (RAGFlow prefixes each trace with `ragflow-`).
  33. For every user request you will see:
  34. • a **trace** representing the overall request
  35. • **spans** for retrieval, ranking and generation steps
  36. • the complete **prompts**, **retrieved documents** and **LLM responses** as metadata
  37. ![Example Ragflow trace in Langfuse](https://langfuse.com/images/docs/ragflow/ragflow-trace-frame.png)
  38. ([Example trace in Langfuse](https://cloud.langfuse.com/project/cloramnkj0002jz088vzn1ja4/traces/0bde9629-4251-4386-b583-26101b8e7561?timestamp=2025-05-09T19%3A15%3A37.797Z&display=details&observation=823997d8-ac40-40f3-8e7b-8aa6753b499e))
  39. :::tip NOTE
  40. Use Langfuse's diff view to compare prompt versions or drill down into long-running retrievals to identify bottlenecks.
  41. :::