Skip to content

Commit bd4d16b

Browse files
committed
fix preload
1 parent a9fde4f commit bd4d16b

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

packages/node/src/integrations/http/SentryHttpInstrumentation.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import type * as http from 'node:http';
22
import type * as https from 'node:https';
3-
import { context } from '@opentelemetry/api';
43
import { VERSION } from '@opentelemetry/core';
54
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
65
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';
97
import type { SanitizedRequestData } from '@sentry/types';
108
import {
119
getBreadcrumbLogLevelFromHttpStatusCode,
1210
getSanitizedUrlString,
1311
parseUrl,
1412
stripUrlQueryAndFragment,
1513
} from '@sentry/utils';
14+
import { withIsolationScope } from '../..';
1615
import type { NodeClient } from '../../sdk/client';
1716

1817
type Http = typeof http;
@@ -129,13 +128,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
129128

130129
isolationScope.setTransactionName(bestEffortTransactionName);
131130

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, () => {
139132
return original.apply(this, [event, ...args]);
140133
});
141134
};

packages/node/src/integrations/tracing/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Integration } from '@sentry/types';
2-
import { instrumentHttp } from '../http';
32

43
import { amqplibIntegration, instrumentAmqplib } from './amqplib';
54
import { connectIntegration, instrumentConnect } from './connect';
@@ -54,7 +53,6 @@ export function getAutoPerformanceIntegrations(): Integration[] {
5453
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5554
export function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => void) & { id: string })[] {
5655
return [
57-
instrumentHttp,
5856
instrumentExpress,
5957
instrumentConnect,
6058
instrumentFastify,

packages/opentelemetry/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export { wrapClientClass } from './custom/client';
77

88
export { getSpanKind } from './utils/getSpanKind';
99

10-
export { getScopesFromContext, setScopesOnContext } from './utils/contextData';
10+
export { getScopesFromContext } from './utils/contextData';
1111

1212
export {
1313
spanHasAttributes,

0 commit comments

Comments
 (0)