Skip to content

Commit 341bc4c

Browse files
authored
ref(tracing-internal): Deprecate tracePropagationTargets in BrowserTracing (#8874)
This PR deprecates `BrowserTracing`'s `tracePropagationTargets` option in favour of the top-level Sentry.init option. When introducing Tracing without Performance, we opted to [promote `tracePropagationTargets` to a top-level option](#8395). We deprecated the integration-level option in Node's `Http` integration but not in `BrowserTracing`. This patch fixes that.
1 parent 5afb861 commit 341bc4c

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

packages/node/src/integrations/http.ts

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ interface TracingOptions {
3434
* array, and only attach tracing headers if a match was found.
3535
*
3636
* @deprecated Use top level `tracePropagationTargets` option instead.
37+
* This option will be removed in v8.
38+
*
3739
* ```
3840
* Sentry.init({
3941
* tracePropagationTargets: ['api.site.com'],

packages/sveltekit/test/client/sdk.test.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ describe('Sentry client SDK', () => {
109109
it('Merges a user-provided BrowserTracing integration with the automatically added one', () => {
110110
init({
111111
dsn: 'https://[email protected]/1337',
112-
integrations: [
113-
new BrowserTracing({ tracePropagationTargets: ['myDomain.com'], startTransactionOnLocationChange: false }),
114-
],
112+
integrations: [new BrowserTracing({ finalTimeout: 10, startTransactionOnLocationChange: false })],
115113
enableTracing: true,
116114
});
117115

@@ -126,8 +124,7 @@ describe('Sentry client SDK', () => {
126124
expect(browserTracing).toBeDefined();
127125

128126
// This shows that the user-configured options are still here
129-
expect(options.tracePropagationTargets).toEqual(['myDomain.com']);
130-
expect(options.startTransactionOnLocationChange).toBe(false);
127+
expect(options.finalTimeout).toEqual(10);
131128

132129
// But we force the routing instrumentation to be ours
133130
expect(options.routingInstrumentation).toEqual(svelteKitRoutingInstrumentation);

packages/tracing-internal/src/browser/browsertracing.ts

+1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export class BrowserTracing implements Integration {
248248
// This is done as it minimizes bundle size (we don't have to have undefined checks).
249249
//
250250
// If both 1 and either one of 2 or 3 are set (from above), we log out a warning.
251+
// eslint-disable-next-line deprecation/deprecation
251252
const tracePropagationTargets = clientOptionsTracePropagationTargets || this.options.tracePropagationTargets;
252253
if (__DEBUG_BUILD__ && this._hasSetTracePropagationTargets && clientOptionsTracePropagationTargets) {
253254
logger.warn(

packages/tracing-internal/src/browser/request.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ export interface RequestInstrumentationOptions {
2727
* List of strings and/or regexes used to determine which outgoing requests will have `sentry-trace` and `baggage`
2828
* headers attached.
2929
*
30-
* Default: ['localhost', /^\//] {@see DEFAULT_TRACE_PROPAGATION_TARGETS}
30+
* @deprecated Use the top-level `tracePropagationTargets` option in `Sentry.init` instead.
31+
* This option will be removed in v8.
32+
*
33+
* Default: ['localhost', /^\//] @see {DEFAULT_TRACE_PROPAGATION_TARGETS}
3134
*/
3235
tracePropagationTargets: Array<string | RegExp>;
3336

@@ -125,6 +128,7 @@ export function instrumentOutgoingRequests(_options?: Partial<RequestInstrumenta
125128
const {
126129
traceFetch,
127130
traceXHR,
131+
// eslint-disable-next-line deprecation/deprecation
128132
tracePropagationTargets,
129133
// eslint-disable-next-line deprecation/deprecation
130134
tracingOrigins,

0 commit comments

Comments
 (0)