What
Buffer ingestion events in memory and flush them to the Langfuse endpoint in a background thread, using Mutex for thread-safe queue access. Provide a flush method and an at-exit hook for graceful shutdown.
Why
The current implementation fires an HTTP request synchronously on every create or update call, blocking the calling thread and adding latency to instrumented code. Production use cases (high-throughput Rails apps, batch pipelines) require non-blocking, batched I/O. The competing langfuse-ruby (ai-firstly) gem already ships async flush.
Effort estimate
M (2–3 days) — implement a thread-safe event queue, a background flush loop, configurable batch size and flush interval, and at-exit drain.
What
Buffer ingestion events in memory and flush them to the Langfuse endpoint in a background thread, using
Mutexfor thread-safe queue access. Provide aflushmethod and an at-exit hook for graceful shutdown.Why
The current implementation fires an HTTP request synchronously on every
createorupdatecall, blocking the calling thread and adding latency to instrumented code. Production use cases (high-throughput Rails apps, batch pipelines) require non-blocking, batched I/O. The competing langfuse-ruby (ai-firstly) gem already ships async flush.Effort estimate
M (2–3 days) — implement a thread-safe event queue, a background flush loop, configurable batch size and flush interval, and at-exit drain.