|
1 | 1 | import type * as http from 'node:http';
|
2 | 2 | import type * as https from 'node:https';
|
3 |
| -import { context } from '@opentelemetry/api'; |
4 | 3 | import { VERSION } from '@opentelemetry/core';
|
5 | 4 | import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
6 | 5 | import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
7 |
| -import { addBreadcrumb, getClient, getCurrentScope, getIsolationScope } from '@sentry/core'; |
8 |
| -import { setScopesOnContext } from '@sentry/opentelemetry'; |
| 6 | +import { addBreadcrumb, getClient, getIsolationScope } from '@sentry/core'; |
9 | 7 | import type { SanitizedRequestData } from '@sentry/types';
|
10 | 8 | import {
|
11 | 9 | getBreadcrumbLogLevelFromHttpStatusCode,
|
12 | 10 | getSanitizedUrlString,
|
13 | 11 | parseUrl,
|
14 | 12 | stripUrlQueryAndFragment,
|
15 | 13 | } from '@sentry/utils';
|
| 14 | +import { withIsolationScope } from '../..'; |
16 | 15 | import type { NodeClient } from '../../sdk/client';
|
17 | 16 |
|
18 | 17 | type Http = typeof http;
|
@@ -129,13 +128,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
|
129 | 128 |
|
130 | 129 | isolationScope.setTransactionName(bestEffortTransactionName);
|
131 | 130 |
|
132 |
| - const parentContext = context.active(); |
133 |
| - const requestContext = setScopesOnContext(parentContext, { |
134 |
| - scope: getCurrentScope(), |
135 |
| - isolationScope, |
136 |
| - }); |
137 |
| - |
138 |
| - return context.with(requestContext, () => { |
| 131 | + return withIsolationScope(isolationScope, () => { |
139 | 132 | return original.apply(this, [event, ...args]);
|
140 | 133 | });
|
141 | 134 | };
|
|
0 commit comments