Foglamp batches spans in memory and flushes them fire-and-forget. In a long-running server that is invisible; in serverless environments the process can freeze or terminate before a batch is sent. The rule:Documentation Index
Fetch the complete documentation index at: https://docs.foglamp.dev/llms.txt
Use this file to discover all available pages before exploring further.
Anything you don’t flush before the runtime suspends is lost. The buffer is
volatile by design — it never blocks your model calls.
wt.flush() or by passing a waitUntil hook.
Long-running (Node, Bun)
Nothing to do. The collector flushes everyflushIntervalMs (default 5s) and on
early batch limits. For clean shutdown, drain the buffer on exit:
Vercel functions
The collector auto-detects Vercel and useswaitUntil to keep the function
alive until the flush completes. If detection doesn’t fire, pass it explicitly:
Cloudflare Workers
Workers don’t expose a globalwaitUntil; it lives on the request ctx. Thread
it through so the flush survives the response:
AWS Lambda
Lambda freezes the execution environment the moment your handler returns, so a background flush may never run. Await the flush before returning — do not rely onprocess.on("beforeExit"), which won’t fire.
Manual flush anywhere
wt.flush() works in every runtime and resolves when the request completes.
It’s safe to call when the collector is disabled (it resolves immediately), so
you can leave it in unconditionally.