diff --git a/x-pack/plugins/apm/server/utils/with_span.ts b/x-pack/plugins/apm/server/utils/with_span.ts index be3279772d1df..b0c07fac4a0fe 100644 --- a/x-pack/plugins/apm/server/utils/with_span.ts +++ b/x-pack/plugins/apm/server/utils/with_span.ts @@ -43,6 +43,7 @@ export function withSpan( const resource = new asyncHooks.AsyncResource('fake_async'); return resource.runInAsyncScope(() => { + // set the active span for the newly created async context // @ts-ignore agent._instrumentation.activeSpan = span; if (type) {