+async function wrapWithSpanAndContext <T> (spanName: string, cb: () => Promise<T>) {
+ const span = tracer.startSpan(spanName)
+ const activeContext = trace.setSpan(context.active(), span)
+
+ const result = await context.with(activeContext, () => cb())
+ span.end()
+
+ return result
+}