Skip to main content

Function: withStoredTrace()

withStoredTrace<T>(stored, fn): Promise<T>

Defined in: packages/messaging/src/trace.ts:93

Runs fn with a stored trace as the active context, so a span started inside is its child and a header injected inside carries the original trace id. With nothing stored (or no SDK) it just runs fn.

Type Parameters​

T​

T

Parameters​

stored​

What captureTrace returned when the row was written.

traceparent?​

string | null

tracestate?​

string | null

fn​

() => Promise<T>

The publish.

Returns​

Promise<T>

What fn returns.