Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(tracing-internal): Deprecate tracePropagationTargets in BrowserTracing #8874

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/node/src/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ interface TracingOptions {
* array, and only attach tracing headers if a match was found.
*
* @deprecated Use top level `tracePropagationTargets` option instead.
* This option will be removed in v8.
*
* ```
* Sentry.init({
* tracePropagationTargets: ['api.site.com'],
Expand Down
7 changes: 2 additions & 5 deletions packages/sveltekit/test/client/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ describe('Sentry client SDK', () => {
it('Merges a user-provided BrowserTracing integration with the automatically added one', () => {
init({
dsn: 'https://[email protected]/1337',
integrations: [
new BrowserTracing({ tracePropagationTargets: ['myDomain.com'], startTransactionOnLocationChange: false }),
],
integrations: [new BrowserTracing({ finalTimeout: 10, startTransactionOnLocationChange: false })],
enableTracing: true,
});

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

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

// But we force the routing instrumentation to be ours
expect(options.routingInstrumentation).toEqual(svelteKitRoutingInstrumentation);
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/browsertracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export class BrowserTracing implements Integration {
// This is done as it minimizes bundle size (we don't have to have undefined checks).
//
// If both 1 and either one of 2 or 3 are set (from above), we log out a warning.
// eslint-disable-next-line deprecation/deprecation
const tracePropagationTargets = clientOptionsTracePropagationTargets || this.options.tracePropagationTargets;
if (__DEBUG_BUILD__ && this._hasSetTracePropagationTargets && clientOptionsTracePropagationTargets) {
logger.warn(
Expand Down
6 changes: 5 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export interface RequestInstrumentationOptions {
* List of strings and/or regexes used to determine which outgoing requests will have `sentry-trace` and `baggage`
* headers attached.
*
* Default: ['localhost', /^\//] {@see DEFAULT_TRACE_PROPAGATION_TARGETS}
* @deprecated Use the top-level `tracePropagationTargets` option in `Sentry.init` instead.
* This option will be removed in v8.
*
* Default: ['localhost', /^\//] @see {DEFAULT_TRACE_PROPAGATION_TARGETS}
*/
tracePropagationTargets: Array<string | RegExp>;

Expand Down Expand Up @@ -125,6 +128,7 @@ export function instrumentOutgoingRequests(_options?: Partial<RequestInstrumenta
const {
traceFetch,
traceXHR,
// eslint-disable-next-line deprecation/deprecation
tracePropagationTargets,
// eslint-disable-next-line deprecation/deprecation
tracingOrigins,
Expand Down