Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docker-compose-langfuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,22 @@ services:
user: "101:101"
container_name: langfuse-clickhouse
hostname: langfuse-clickhouse
# ClickHouse merges open thousands of sparse subcolumn files at once; the
# Docker default nofile (4096) breaks them with errno 24 and the failing
# merge is hot-retried forever, pinning CPU cores. Same limit the
# observability clickhouse already runs with.
ulimits:
nofile:
soft: 262144
hard: 262144
environment:
CLICKHOUSE_DB: ${LANGFUSE_CLICKHOUSE_DB:-default}
CLICKHOUSE_USER: ${LANGFUSE_CLICKHOUSE_USER:-clickhouse}
CLICKHOUSE_PASSWORD: ${LANGFUSE_CLICKHOUSE_PASSWORD:-clickhouse}
volumes:
- langfuse-clickhouse-data:/var/lib/clickhouse
- langfuse-clickhouse-logs:/var/log/clickhouse-server
- ./langfuse/clickhouse/system-logs.xml:/etc/clickhouse-server/config.d/system-logs.xml:ro
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1
interval: 5s
Expand Down
41 changes: 41 additions & 0 deletions langfuse/clickhouse/system-logs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
Bounded retention for ClickHouse system log tables.

Without TTLs the system tables (trace_log above all) grow unbounded, which
keeps scheduling giant merges over tens of thousands of historic parts. With
the nofile limit raised these merges complete, but they still should not
exist: analytics-grade tracing only needs the last few days locally.
-->
<clickhouse>
<logger>
<level>warning</level>
</logger>

<trace_log>
<ttl>event_date + INTERVAL 3 DAY DELETE</ttl>
</trace_log>

<text_log>
<ttl>event_date + INTERVAL 3 DAY DELETE</ttl>
</text_log>

<metric_log>
<ttl>event_date + INTERVAL 7 DAY DELETE</ttl>
</metric_log>

<query_log>
<ttl>event_date + INTERVAL 7 DAY DELETE</ttl>
</query_log>

<part_log>
<ttl>event_date + INTERVAL 7 DAY DELETE</ttl>
</part_log>

<processors_profile_log>
<ttl>event_date + INTERVAL 7 DAY DELETE</ttl>
</processors_profile_log>

<asynchronous_metric_log>
<ttl>event_date + INTERVAL 7 DAY DELETE</ttl>
</asynchronous_metric_log>
</clickhouse>