@@ -3,14 +3,15 @@ import { SpanKind } from '@opentelemetry/api';
33import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
44import { HttpInstrumentation } from '@opentelemetry/instrumentation-http' ;
55import { SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
6- import { hasTracingEnabled , Transaction } from '@sentry/core' ;
6+ import { hasTracingEnabled , isSentryRequestUrl , Transaction } from '@sentry/core' ;
77import { getCurrentHub } from '@sentry/node' ;
88import { _INTERNAL_getSentrySpan } from '@sentry/opentelemetry-node' ;
99import type { EventProcessor , Hub , Integration } from '@sentry/types' ;
1010import type { ClientRequest , IncomingMessage , ServerResponse } from 'http' ;
1111
1212import type { NodeExperimentalClient , OtelSpan } from '../types' ;
1313import { getRequestSpanData } from '../utils/getRequestSpanData' ;
14+ import { getRequestUrl } from '../utils/getRequestUrl' ;
1415
1516interface TracingOptions {
1617 /**
@@ -93,8 +94,8 @@ export class Http implements Integration {
9394 instrumentations : [
9495 new HttpInstrumentation ( {
9596 ignoreOutgoingRequestHook : request => {
96- const host = request . host || request . hostname ;
97- return isSentryHost ( host ) ;
97+ const url = getRequestUrl ( request ) ;
98+ return url ? isSentryRequestUrl ( url , getCurrentHub ( ) ) : false ;
9899 } ,
99100
100101 ignoreIncomingRequestHook : request => {
@@ -224,11 +225,3 @@ function getHttpUrl(attributes: Attributes): string | undefined {
224225 const url = attributes [ SemanticAttributes . HTTP_URL ] ;
225226 return typeof url === 'string' ? url : undefined ;
226227}
227-
228- /**
229- * Checks whether given host points to Sentry server
230- */
231- function isSentryHost ( host : string | undefined ) : boolean {
232- const dsn = getCurrentHub ( ) . getClient ( ) ?. getDsn ( ) ;
233- return dsn && host ? host . includes ( dsn . host ) : false ;
234- }
0 commit comments