Self-hosted Langfuse: tracing 7% of my AI agents, and ClickHouse logging itself
说明与用途
作者自托管 Langfuse 以追踪多个代理配置文件,但跟踪插件仅在一个配置文件上启用,ClickHouse 占用了 6 GiB 磁盘用于 2.2 MiB 的跟踪数据。通过为所有配置文件设置密钥和标签并禁用不必要的 ClickHouse 系统日志,磁盘使用量降至 7.7 GB,跟踪覆盖率提升至 100%。
问题
Only 7% of AI agent calls were traced and ClickHouse consumed 6 GiB of disk for 2.2 MiB of trace data.
结果
Tracing coverage increased from 7% to 100% across profiles; ClickHouse disk usage dropped from 15 GB to 7.7 GB while preserving trace data.
工作流
- Copied Langfuse API keys into each profile’s env file
- Enabled the Langfuse tracing plugin on each profile
- Set the Langfuse environment to the profile name
- Restarted the gateway and sent probe traces to verify tags
- Created a ClickHouse config.d file to remove system log tables and lower logger level
- Recreated the ClickHouse container and verified health and log suppression
证据
Tracing was enabled on exactly one of ten profiles: the default chat one, with 91 calls. That's roughly 7% of the traffic.
ClickHouse was using **6.03 GiB** of disk. The actual Langfuse trace data in it was **2.2 MiB**.
The third step is the one that matters for later. Traces carry no profile tag of their own, so without it every trace lands in one undifferentiated pile.
- 记录日期: 2026-10-27T17:26:43.536Z