Skip to main content

withSpan

@retinue/monorepo


@retinue/monorepo / backend/src / withSpan

Function: withSpan()

withSpan<T>(tracer, name, options, fn): Promise<T>

Defined in: backend/src/telemetry/index.ts:110

Run fn inside a span, ending it on both paths and recording a failure.

A helper rather than a method on the port, so an adapter cannot get the error path wrong. Every adapter getting try/finally right independently is a guarantee that holds until the second adapter.

Type Parameters​

T​

T

Parameters​

tracer​

Tracer

name​

string

options​

SpanOptions

fn​

(span) => Promise<T>

Returns​

Promise<T>