Skip to content

Commit a019a0a

Browse files
committed
avoid breaking change in instrumentOutgoingRequests
1 parent 4d3e188 commit a019a0a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/tracing/src/browser/request.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const defaultRequestInstrumentationOptions: RequestInstrumentationOptions
113113
/** Registers span creators for xhr and fetch requests */
114114
export function instrumentOutgoingRequests(_options?: Partial<RequestInstrumentationOptions>): void {
115115
// eslint-disable-next-line deprecation/deprecation
116-
const { traceFetch, traceXHR, tracePropagationTargets, shouldCreateSpanForRequest } = {
116+
const { traceFetch, traceXHR, tracePropagationTargets, tracingOrigins, shouldCreateSpanForRequest } = {
117117
traceFetch: defaultRequestInstrumentationOptions.traceFetch,
118118
traceXHR: defaultRequestInstrumentationOptions.traceXHR,
119119
..._options,
@@ -122,7 +122,11 @@ export function instrumentOutgoingRequests(_options?: Partial<RequestInstrumenta
122122
const shouldCreateSpan =
123123
typeof shouldCreateSpanForRequest === 'function' ? shouldCreateSpanForRequest : (_: string) => true;
124124

125-
const shouldAttachHeadersWithTargets = (url: string): boolean => shouldAttachHeaders(url, tracePropagationTargets);
125+
// TODO(v8) Remove tracingOrigins here
126+
// The only reason we're passing it in here is because this instrumentOutgoingRequests function is publicly exported
127+
// and we don't want to break the API. We can remove it in v8.
128+
const shouldAttachHeadersWithTargets = (url: string): boolean =>
129+
shouldAttachHeaders(url, tracePropagationTargets || tracingOrigins);
126130

127131
const spans: Record<string, Span> = {};
128132

0 commit comments

Comments
 (0)