Self-hosted Langfuse: tracing 7% of my AI agents, and ClickHouse logging itself
Description and use
The author self-hosted Langfuse to trace AI agents but initially enabled tracing only on one profile, limiting visibility to 7 %. After configuring keys and tags for all ten profiles and optimizing ClickHouse logs, full trace data was obtained and disk usage was cut by nearly half.
Problem
Only 7% of agent traffic was being traced, causing incomplete visibility into agent behavior and performance.
Outcome
All profiles now produce trace data, enabling role‑based cost and latency analysis; ClickHouse disk usage dropped by ~50 % by removing unused system logs.
Workflow
- Enable Langfuse plugin on each profile
- Copy Langfuse API keys into each profile’s secret scope
- Set Langfuse environment to profile name
- Restart gateway and verify traces are tagged
- Configure ClickHouse to remove unnecessary system log tables and set query_log TTL
- Restart ClickHouse container and confirm logs stopped writing
- Delete old log data to reclaim disk space
Evidence
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.
- Record date: 2026-10-01T09:37:58.011Z