(spanName: string, fn: () => Promise<Res>)
| 4 | export const tracer = trace.getTracer('contentlayer') |
| 5 | |
| 6 | export 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) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…