From 44e66173cd360a73fecaa96003f0f1b3ab6665ae Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 22 Nov 2022 15:31:34 +0100 Subject: [PATCH] avoid breaking change in `instrumentOutgoingRequests` --- packages/tracing/src/browser/request.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/tracing/src/browser/request.ts b/packages/tracing/src/browser/request.ts index a4c03f88ff76..c065318ae360 100644 --- a/packages/tracing/src/browser/request.ts +++ b/packages/tracing/src/browser/request.ts @@ -113,7 +113,7 @@ export const defaultRequestInstrumentationOptions: RequestInstrumentationOptions /** Registers span creators for xhr and fetch requests */ export function instrumentOutgoingRequests(_options?: Partial): void { // eslint-disable-next-line deprecation/deprecation - const { traceFetch, traceXHR, tracePropagationTargets, shouldCreateSpanForRequest } = { + const { traceFetch, traceXHR, tracePropagationTargets, tracingOrigins, shouldCreateSpanForRequest } = { traceFetch: defaultRequestInstrumentationOptions.traceFetch, traceXHR: defaultRequestInstrumentationOptions.traceXHR, ..._options, @@ -122,7 +122,11 @@ export function instrumentOutgoingRequests(_options?: Partial true; - const shouldAttachHeadersWithTargets = (url: string): boolean => shouldAttachHeaders(url, tracePropagationTargets); + // TODO(v8) Remove tracingOrigins here + // The only reason we're passing it in here is because this instrumentOutgoingRequests function is publicly exported + // and we don't want to break the API. We can remove it in v8. + const shouldAttachHeadersWithTargets = (url: string): boolean => + shouldAttachHeaders(url, tracePropagationTargets || tracingOrigins); const spans: Record = {};