Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/observability / / withCurrentSpan

Function: withCurrentSpan()

ts
function withCurrentSpan<R>(span, fn): R | Promise<R>;

Defined in: packages/observability/src/logger/logger.ts:63

Run fn with the supplied span as the "current" log-correlation span. The logger picks up the trace + span ids automatically.

Type Parameters

Type Parameter
R

Parameters

ParameterType
span| AISpan&lt;SpanType&gt; | undefined
fn() => R | Promise&lt;R&gt;

Returns

R | Promise&lt;R&gt;

Stable