Skip to main content

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.

foglamp(config?) accepts the following options. Every field is optional.
const wt = foglamp({
  apiKey: process.env.FOGLAMP_API_KEY,
  endpoint: process.env.FOGLAMP_INGEST_URL,
  flushIntervalMs: 5000,
  maxBatchTraces: 50,
  maxBatchSpans: 500,
  maxPayloadChars: 100_000,
  recordInputs: true,
  recordOutputs: true,
  debug: false,
  onError: (err) => console.error(err),
});

Options

OptionTypeDefaultDescription
apiKeystringFOGLAMP_API_KEYYour fl_… key. Unset → collector disabled.
endpointstringhttps://ingest.foglamp.dev/ingestIngest URL. Set when self-hosting.
flushIntervalMsnumber5000How often the batch is flushed in long-running runtimes.
maxBatchTracesnumber50Flush early once this many traces are buffered.
maxBatchSpansnumber500Flush early once this many spans are buffered.
maxPayloadCharsnumber100_000Per-field cap for input/output; longer values are truncated.
recordInputsbooleantrueCapture prompt/input text.
recordOutputsbooleantrueCapture completion/output text.
waitUntilfunctionauto-detectedServerless flush hook — see Runtimes.
fetchfunctionglobal fetchCustom fetch implementation.
debugbooleanfalseLog batching/flush activity.
onErrorfunctionCalled on transport/serialization errors instead of throwing.
The ingest contract caps any single input or output field at 1,000,000 characters. maxPayloadChars (default 100,000) truncates earlier so payloads stay small — raise it only if you need fuller logs and can afford the bytes.

Privacy: dropping prompt/response text

To record traces, costs, and latency without ever sending prompt or completion text, disable capture:
const wt = foglamp({
  recordInputs: false,
  recordOutputs: false,
});
Token usage and cost are still computed — they come from the provider’s usage report, not from the text.

Error handling

The collector never throws into your application path. Transport or serialization failures are routed to onError (if provided) or swallowed. Enable debug to trace batching and flush behavior during development.
const wt = foglamp({
  debug: process.env.NODE_ENV !== "production",
  onError: (err) => reportToSentry(err),
});