Skip to content

Function: withSpan()

Prefactor TypeScript SDK


Prefactor TypeScript SDK / @prefactor/core / withSpan

Wraps sync/async work in a span and automatically captures outputs or errors.

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.

T

Tracer

Tracer to use for span lifecycle.

StartSpanOptions

Span creation options.

() => T | Promise<T>

Work to execute within the span context.

Promise<T>

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.

T

StartSpanOptions

Span creation options.

() => T | Promise<T>

Work to execute within the span context.

Promise<T>