@@ -4,12 +4,16 @@ import { SpanKind } from '@opentelemetry/api';
44import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
55import { HttpInstrumentation } from '@opentelemetry/instrumentation-http' ;
66import { hasTracingEnabled , isSentryRequestUrl } from '@sentry/core' ;
7- import { _INTERNAL , getClient , getCurrentHub , getSpanKind , setSpanMetadata } from '@sentry/opentelemetry' ;
7+ import { _INTERNAL , getClient , getCurrentHub , getSpanKind , getSpanScope , setSpanMetadata } from '@sentry/opentelemetry' ;
88import type { EventProcessor , Hub , Integration } from '@sentry/types' ;
99import { stringMatchesSomePattern } from '@sentry/utils' ;
1010
11+ import { getSpanContext } from '@opentelemetry/api/build/src/trace/context-utils' ;
12+ import { getIsolationScope , setIsolationScope } from '../sdk/api' ;
13+ import { Scope } from '../sdk/scope' ;
1114import type { NodeExperimentalClient } from '../types' ;
1215import { addOriginToSpan } from '../utils/addOriginToSpan' ;
16+ import { getScopesFromContext } from '../utils/contextData' ;
1317import { getRequestUrl } from '../utils/getRequestUrl' ;
1418
1519interface HttpOptions {
@@ -127,6 +131,11 @@ export class Http implements Integration {
127131 requireParentforIncomingSpans : false ,
128132 requestHook : ( span , req ) => {
129133 this . _updateSpan ( span , req ) ;
134+
135+ // Update the isolation scope, isolation this request
136+ if ( getSpanKind ( span ) === SpanKind . SERVER ) {
137+ setIsolationScope ( Scope . clone ( getIsolationScope ( ) ) ) ;
138+ }
130139 } ,
131140 responseHook : ( span , res ) => {
132141 this . _addRequestBreadcrumb ( span , res ) ;
0 commit comments