diff --git a/packages/node/src/integrations/http.ts b/packages/node/src/integrations/http.ts index 5e2ce9e253a2..970c60f75839 100644 --- a/packages/node/src/integrations/http.ts +++ b/packages/node/src/integrations/http.ts @@ -20,6 +20,12 @@ interface TracingOptions { * requests. If this option is provided, the SDK will match the * request URL of outgoing requests against the items in this * array, and only attach tracing headers if a match was found. + * + * @deprecated Use top level `tracePropagationTargets` option instead. + * ``` + * Sentry.init({ + * tracePropagationTargets: ['api.site.com'], + * }) */ tracePropagationTargets?: TracePropagationTargets; @@ -156,6 +162,7 @@ function _createWrappedRequestMethodFactory( }; const shouldAttachTraceData = (url: string): boolean => { + // eslint-disable-next-line deprecation/deprecation if (tracingOptions?.tracePropagationTargets === undefined) { return true; } @@ -165,6 +172,7 @@ function _createWrappedRequestMethodFactory( return cachedDecision; } + // eslint-disable-next-line deprecation/deprecation const decision = stringMatchesSomePattern(url, tracingOptions.tracePropagationTargets); headersUrlMap.set(url, decision); return decision; diff --git a/packages/node/src/types.ts b/packages/node/src/types.ts index 3e464d1c6457..b0ecb354dd82 100644 --- a/packages/node/src/types.ts +++ b/packages/node/src/types.ts @@ -1,4 +1,4 @@ -import type { ClientOptions, Options, SamplingContext, TracePropagationTargets } from '@sentry/types'; +import type { ClientOptions, Options, SamplingContext } from '@sentry/types'; import type { NodeTransportOptions } from './transports'; @@ -32,24 +32,6 @@ export interface BaseNodeOptions { */ includeLocalVariables?: boolean; - /** - * List of strings/regex controlling to which outgoing requests - * the SDK will attach tracing headers. - * - * By default the SDK will attach those headers to all outgoing - * requests. If this option is provided, the SDK will match the - * request URL of outgoing requests against the items in this - * array, and only attach tracing headers if a match was found. - * - * @example - * ```js - * Sentry.init({ - * tracePropagationTargets: ['api.site.com'], - * }); - * ``` - */ - tracePropagationTargets?: TracePropagationTargets; - // TODO (v8): Remove this in v8 /** * @deprecated Moved to constructor options of the `Http` and `Undici` integration. diff --git a/packages/types/src/options.ts b/packages/types/src/options.ts index 0f8a163b2615..60d747136d90 100644 --- a/packages/types/src/options.ts +++ b/packages/types/src/options.ts @@ -5,6 +5,7 @@ import type { Integration } from './integration'; import type { CaptureContext } from './scope'; import type { SdkMetadata } from './sdkmetadata'; import type { StackLineParser, StackParser } from './stacktrace'; +import type { TracePropagationTargets } from './tracing'; import type { SamplingContext } from './transaction'; import type { BaseTransportOptions, Transport } from './transport'; @@ -221,6 +222,24 @@ export interface ClientOptions; + /** + * List of strings/regex controlling to which outgoing requests + * the SDK will attach tracing headers. + * + * By default the SDK will attach those headers to all outgoing + * requests. If this option is provided, the SDK will match the + * request URL of outgoing requests against the items in this + * array, and only attach tracing headers if a match was found. + * + * @example + * ```js + * Sentry.init({ + * tracePropagationTargets: ['api.site.com'], + * }); + * ``` + */ + tracePropagationTargets?: TracePropagationTargets; + /** * Function to compute tracing sample rate dynamically and filter unwanted traces. *