Skip to content

Commit ea66b45

Browse files
committed
fixup! fixup! feat(http): portable node:http client instrumentation (#20393)
1 parent eac6329 commit ea66b45

4 files changed

Lines changed: 11 additions & 29 deletions

File tree

packages/core/src/integrations/http/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface HttpClientRequest {
5151

5252
/** Minimal interface for http client RequestOptions */
5353
export interface HttpRequestOptions {
54-
method?: string | null;
54+
method?: string;
5555
protocol?: string | null;
5656
hostname?: string | null;
5757
host?: string | null;

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ import type {
1212
HttpModuleExport,
1313
Span,
1414
} from '@sentry/core';
15-
import { getHttpClientSubscriptions, patchHttpModuleClient, patchHttpsModuleClient, SDK_VERSION } from '@sentry/core';
15+
import {
16+
getHttpClientSubscriptions,
17+
patchHttpModuleClient,
18+
patchHttpsModuleClient,
19+
SDK_VERSION,
20+
getRequestOptions,
21+
} from '@sentry/core';
1622
import { INSTRUMENTATION_NAME } from './constants';
1723
import { HTTP_ON_CLIENT_REQUEST } from '@sentry/core';
1824
import { NODE_VERSION } from '../../nodeVersion';
1925
import { errorMonitor } from 'node:events';
20-
import { getRequestOptions } from '../../utils/outgoingHttpRequest';
2126

2227
const FULLY_SUPPORTS_HTTP_DIAGNOSTICS_CHANNEL =
2328
(NODE_VERSION.major === 22 && NODE_VERSION.minor >= 12) ||

packages/node-core/src/light/integrations/httpIntegration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import {
1414
stripUrlQueryAndFragment,
1515
SUPPRESS_TRACING_KEY,
1616
withIsolationScope,
17+
getRequestOptions,
18+
getRequestUrlFromClientRequest,
1719
} from '@sentry/core';
1820
import type { ClientRequest, IncomingMessage, Server } from 'node:http';
1921
import { DEBUG_BUILD } from '../../debug-build';
2022
import { patchRequestToCaptureBody } from '../../utils/captureRequestBody';
21-
import { getClientRequestUrl, getRequestOptions } from '../../utils/outgoingHttpRequest';
2223
import type { LightNodeClient } from '../client';
2324
import { errorMonitor } from 'node:events';
2425
import { NODE_VERSION } from '../../nodeVersion';
@@ -160,7 +161,7 @@ function onOutgoingResponseFinish(
160161
}
161162
const { ignoreOutgoingRequests } = options;
162163
if (ignoreOutgoingRequests) {
163-
const url = getClientRequestUrl(request as ClientRequest);
164+
const url = getRequestUrlFromClientRequest(request as ClientRequest);
164165
if (ignoreOutgoingRequests(url, getRequestOptions(request as ClientRequest))) {
165166
return;
166167
}

packages/node-core/src/utils/outgoingHttpRequest.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)