TheDocumentation 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 package exposes a single factory, foglamp(), which
returns a collector. The collector batches spans and flushes them to your
ingest endpoint, and produces telemetry integrations you attach to AI SDK calls.
The SDK requires AI SDK v7 and declares
ai@7 as a peer dependency. It
ships zero runtime dependencies of its own and never forces a particular
version of zod on your project.foglamp(config?)
Creates a collector. All configuration is optional; sensible defaults apply and
missing credentials disable the collector silently. See
Configuration for the full option table.
apiKey is unset (and not in the environment), the collector is disabled:
integrations become no-ops, nothing is sent, and nothing is thrown.
Collector methods
wt.integration(context?)
Returns a telemetry integration to pass into a call’s
experimental_telemetry.integrations array. The optional context labels every
span the call produces.
| Context field | Type | Notes |
|---|---|---|
agentName | string | the actor responsible for the call |
workflowName | string | the named process |
workflowRunId | string | groups traces into one run |
sessionId | string | ties traces to one conversation |
metadata | Record<string, string | number | boolean> | free-form labels |
wt.flush()
Sends any buffered spans immediately and resolves when the request completes.
Call this before a serverless function returns, or on shutdown. Safe to call
when the collector is disabled (resolves immediately).
wt.shutdown()
Stops the flush timer and performs a final flush. Use on graceful process
shutdown in long-running servers.
Registration paths
Per-call
Pass
wt.integration(...) into a single call’s telemetry. Fully typed, and
wins over any global registration.Global
registerTelemetry(foglamp()) instruments every call. Reads functionId
as agentName and reserved keys from telemetry.metadata.