process.beforeExit handler for
automatic shutdown. The process guard is safe in non-Node
environments but OTel SDK dependencies require Node.js >= 20.
Methods
constructor(config: FiddlerClientConfig)
Create a new Fiddler client and initialize the OTel provider.
Client configuration including Fiddler URL, API key,
and application ID.
async flush(): Promise<void>
Force-flush all buffered spans to the Fiddler backend.
Call this before process exit in short-lived scripts to ensure all
spans are exported.
async shutdown(): Promise<void>
Flush remaining spans and shut down the underlying OTel provider.
After shutdown the client cannot create new spans. This method is
idempotent — calling it multiple times is safe.
startAgent(name: string, options?: Omit<StartSpanOptions, "type">): FiddlerAgentSpan
Start a new agent/chain span (sets fiddler.span.type to "chain").
Human-readable name for the agent span.
Optional parent span for nesting.
return
A new FiddlerAgentSpan with agent-specific helpers.
startGeneration(name: string, options?: Omit<StartSpanOptions, "type">): FiddlerGenerationSpan
Start a new LLM generation span (sets fiddler.span.type to "llm").
Human-readable name for the generation span.
Optional parent span for nesting.
return
A new FiddlerGenerationSpan with LLM-specific helpers.
startSpan(name: string, options?: StartSpanOptions): FiddlerSpan
Start a new span with an optional explicit type.
Human-readable name for the span.
Optional span type and parent span.
return
A new FiddlerSpan instance.
startTool(name: string, options?: Omit<StartSpanOptions, "type">): FiddlerToolSpan
Start a new tool span (sets fiddler.span.type to "tool").
Human-readable name for the tool span.
Optional parent span for nesting.
return
A new FiddlerToolSpan with tool-specific helpers.