Back to Lobehub

Observability and Tracing for LobeHub

docs/self-hosting/advanced/observability/langfuse.mdx

2.1.562.8 KB
Original Source

Monitor your LobeHub application with Langfuse

What is Langfuse?

Langfuse an open-source LLM Observability platform. By enabling the Langfuse integration, you can trace your application data to develop, monitor, and improve the use of LobeHub, including:

Get Started

<Steps> ### Set up Langfuse

Get your Langfuse API key by signing up for Langfuse Cloud or self-hosting Langfuse.

Set up LobeHub

There are multiple ways to self-host LobeHub. For this example, we will use the Docker Desktop deployment.

<Tabs items={["Environment Variables", "Example in Docker Desktop"]}> <Tab> Before deploying LobeHub, set the following four environment variables with the Langfuse API keys you created in the previous step.

  ```sh
  ENABLE_LANGFUSE = '1'
  LANGFUSE_SECRET_KEY = 'sk-lf...'
  LANGFUSE_PUBLIC_KEY = 'pk-lf...'
  LANGFUSE_HOST = 'https://cloud.langfuse.com'
  ```
</Tab>

<Tab>
  Before running the Docker container, set the environment variables in the Docker Desktop with the Langfuse API keys you created in the previous step.

  <Image alt={'Environment Variables in Docker Desktop'} src={'https://langfuse.com/images/docs/LobeHub-docker-desktop-env.png'} />
</Tab>
</Tabs>

Activate Analytics in Settings

Once you have LobeHub running, navigate to the About tab in the Settings and activate analytics. This is necessary for traces to be sent to Langfuse.

<Image alt={'LobeHub Settings'} src={'https://langfuse.com/images/docs/LobeHub-settings.png'} />

See Chat Traces in Langfuse

After setting your LLM model key, you can start interacting with your LobeHub application.

<Image alt={'LobeHub Conversation'} src={'https://langfuse.com/images/docs/LobeHub-converstation.png'} />

All conversations in the chat are automatically traced and sent to Langfuse. You can view the traces in the Traces section in the Langfuse UI.

<Image alt={'LobeHub Example Trace'} src={'https://langfuse.com/images/docs/LobeHub-example-trace.png'} />

Example trace in the Langfuse UI </Steps>

Feedback

If you have any feedback or requests, please create a GitHub Issue or share your work with the Langfuse community on Discord.