Skip to content

Commit ea0788a

Browse files
Lms24imatwawana
authored andcommitted
ref: Clarify JS tracingOrigins Default Values (#5593)
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]>
1 parent 695a239 commit ea0788a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/platforms/javascript/common/performance/instrumentation/automatic-instrumentation.mdx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ Supported options:
5252

5353
### tracingOrigins
5454

55-
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.**
55+
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.
56+
57+
**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.**
58+
59+
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`).
5660

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

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

101105
The default is `true`.
102106

107+
### \_experiments
103108

104-
### _experiments
105-
106-
This is an object containing experimental flags for features that may involve breaking changes that haven't yet landed in a new major version.
109+
This is an object containing experimental flags for features that haven't yet landed in a new major version and might include breaking changes.
107110

108111
The default is
112+
109113
```
110114
{
111115
enableLongTasks: true
112116
}
113117
```
114118

115-
#### _experiments.enableLongTasks
119+
#### \_experiments.enableLongTasks
116120

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

0 commit comments

Comments
 (0)