MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / traceAsync

Function traceAsync

packages/@contentlayer/utils/src/tracing.ts:6–15  ·  view source on GitHub ↗
(spanName: string, fn: () => Promise<Res>)

Source from the content-addressed store, hash-verified

4export const tracer = trace.getTracer('contentlayer')
5
6export const traceAsync = <Res>(spanName: string, fn: () => Promise<Res>): Promise<Res> => {
7 return tracer.startActiveSpan(spanName, (span) => {
8 return fn()
9 .catch((e) => {
10 span.setStatus({ code: SpanStatusCode.ERROR, message: e.toString() })
11 throw e
12 })
13 .finally(() => span.end())
14 })
15}
16
17/**
18 * For convenience (instead of providing a mapping function)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…