Skip to content

Commit

Permalink
ref: Clarify JS tracingOrigins Default Values (#5593)
Browse files Browse the repository at this point in the history
Clarify the meaning of the JS SDK's default values for the `tracingOrigins` option of the `BrowserTracing` integration. As pointed out in getsentry/sentry-javascript#5868 ([comment](getsentry/sentry-javascript#5868 (comment))), it is not obvious on first glance, to which requests tracing headers are attached if the default values are used. This PR therefore adds an explanation and slightly changes the ordering of the `tracingOrigins` description. 

Co-authored-by: Isabel <[email protected]>
  • Loading branch information
Lms24 and imatwawana committed Oct 6, 2022
1 parent 28a1b91 commit def54d3
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ Supported options:

### tracingOrigins

The default value of `tracingOrigins` is `['localhost', /^\//]`. The JavaScript SDK will attach the `sentry-trace` and `baggage` headers to all outgoing XHR/fetch requests whose destination contains a string in the list or matches a regex in the list. If your frontend is making requests to a different domain, you will need to add it there to propagate the `sentry-trace` and `baggage` headers to the backend services, which is required to link transactions together as part of a single trace. **The `tracingOrigins` option matches against the whole request URL, not just the domain. Using stricter regex to match certain parts of the URL ensures that requests do not unnecessarily have the additional headers attached.**
A list of strings and regular expressions. The JavaScript SDK will attach the `sentry-trace` and `baggage` headers to all outgoing XHR/fetch requests whose destination contains a string in the list or matches a regex in the list. If your frontend is making requests to a different domain, you'll need to add it there to propagate the `sentry-trace` and `baggage` headers to the backend services, which is required to link transactions together as part of a single trace.

**The `tracingOrigins` option matches against the whole request URL, not just the domain. Using stricter regex to match certain parts of the URL ensures that requests do not unnecessarily have the additional headers attached.**

The default value of `tracingOrigins` is `['localhost', /^\//]`. This means that by default, tracing headers are only attached to requests that contain `localhost` in their URL or requests whose URL starts with a `'/'` (for example `GET /api/v1/users`).

<PlatformContent includePath="performance/tracingOrigins-example" />

Expand Down Expand Up @@ -100,19 +104,19 @@ This option flags transactions when tabs are moved to the background with "cance

The default is `true`.

### \_experiments

### _experiments

This is an object containing experimental flags for features that may involve breaking changes that haven't yet landed in a new major version.
This is an object containing experimental flags for features that haven't yet landed in a new major version and might include breaking changes.

The default is

```
{
enableLongTasks: true
}
```

#### _experiments.enableLongTasks
#### \_experiments.enableLongTasks

This experimental option determines whether spans for long tasks automatically get created.

Expand Down

1 comment on commit def54d3

@vercel
Copy link

@vercel vercel bot commented on def54d3 Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.