Function: withSpan()
Prefactor TypeScript SDK / @prefactor/core / withSpan
Function: withSpan()
Section titled “Function: withSpan()”Wraps sync/async work in a span and automatically captures outputs or errors.
Call Signature
Section titled “Call Signature”withSpan<
T>(tracer,options,fn):Promise<T>
Defined in: packages/core/src/tracing/with-span.ts:12
Runs work inside a new span using an explicit tracer.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”tracer
Section titled “tracer”Tracer to use for span lifecycle.
options
Section titled “options”Span creation options.
() => T | Promise<T>
Work to execute within the span context.
Returns
Section titled “Returns”Promise<T>
Call Signature
Section titled “Call Signature”withSpan<
T>(options,fn):Promise<T>
Defined in: packages/core/src/tracing/with-span.ts:26
Runs work inside a new span using the globally active tracer.
Throws when no active tracer exists.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”options
Section titled “options”Span creation options.
() => T | Promise<T>
Work to execute within the span context.
Returns
Section titled “Returns”Promise<T>