Skip to content

Commit fc081ce

Browse files
committed
feat(js): Add documentation for new browserTracingIntegration options
1 parent ee2f212 commit fc081ce

File tree

4 files changed

+94
-39
lines changed

4 files changed

+94
-39
lines changed

docs/platforms/javascript/common/configuration/integrations/browsertracing.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ Sentry.init({
3838
integrations: [Sentry.browserTracingIntegration()],
3939
});
4040
```
41+
42+
See <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/#configuration-options">Configuration Options</PlatformLink> for a full list of availalable options for `browserTracingIntegration`

docs/platforms/javascript/common/tracing/instrumentation/automatic-instrumentation.mdx

Lines changed: 86 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Sentry.init({
5050

5151
Supported options:
5252

53-
### tracePropagationTargets
53+
<SdkOption name="tracePropagationTargets" type='Array<string | RegExp>' defaultValue={'[\'localhost\', /^\\\/$/]'}>
5454

5555
<Alert>
5656

@@ -68,90 +68,85 @@ The default value of `tracePropagationTargets` is `['localhost', /^\//]`. This m
6868

6969
You will need to configure your web server [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers) to allow the `sentry-trace` and `baggage` headers. The configuration might look like `"Access-Control-Allow-Headers: sentry-trace"` and `"Access-Control-Allow-Headers: baggage"`, but it depends on your set up. If you do not allow the two headers, the request might be blocked.
7070

71-
### beforeStartSpan
71+
</SdkOption>
72+
73+
<SdkOption name="beforeStartSpan" type='(span: Span) => Span'>
7274

7375
`beforeStartSpan` is called at the start of every `pageload` or `navigation` span, and is passed an object containing data about the span which will be started. With `beforeStartSpan` you can modify that data.
7476

7577
<PlatformContent includePath="performance/beforeNavigate-example" />
7678

79+
</SdkOption>
80+
7781
<Alert>
7882
If you're using React, read our docs to learn how to set up your [React Router
7983
integration](/platforms/javascript/guides/react/configuration/integrations/react-router/).
8084
</Alert>
8185

82-
### shouldCreateSpanForRequest
86+
<SdkOption name="shouldCreateSpanForRequest" type='(url: string) => boolean'>
8387

8488
This function can be used to filter out unwanted spans such as XHRs running
85-
health checks or something similar. If this function isn't specified, spans
86-
will be created for all requests.
89+
health checks or something similar.
8790

8891
<PlatformContent includePath="performance/filter-span-example" />
8992

90-
### idleTimeout
93+
By default, spans will be created for all requests.
94+
95+
</SdkOption>
96+
97+
<SdkOption name="idleTimeout" type='number' defaultValue='1000'>
9198

9299
The idle time, measured in ms, to wait until the pageload/navigation span will be finished, if there are no unfinished spans. The pageload/navigation span will use the end timestamp of the last finished span as the endtime.
93100

94-
The default is `1000`.
101+
</SdkOption>
95102

96-
### finalTimeout
103+
<SdkOption name="finalTimeout" type='number' defaultValue='30000'>
97104

98105
The maximum duration of the pageload/naivgation span, measured in ms. If the duration exceeds the `finalTimeout` value, it will be finished.
99106

100-
The default is `30000`.
107+
</SdkOption>
101108

102-
### childSpanTimeout
109+
<SdkOption name="childSpanTimeout" type='number' defaultValue='15000'>
103110

104111
The time, measured in ms, that a child span may run. If the last started child span is still running for more than this time, the pageload/navigation span will be finished.
105112

106-
The default is `15000`.
113+
</SdkOption>
107114

108-
### instrumentNavigation
115+
<SdkOption name="instrumentNavigation" type='boolean' defaultValue='true'>
109116

110117
This flag enables or disables creation of `navigation` span on history changes.
111118

112-
The default is `true`.
119+
</SdkOption>
113120

114-
### instrumentPageLoad
121+
<SdkOption name="instrumentPageLoad" type='boolean' defaultValue='true'>
115122

116123
This flag enables or disables creation of `pageload` span on first pageload.
117124

118-
The default is `true`.
125+
</SdkOption>
119126

120-
### markBackgroundSpans
127+
<SdkOption name="markBackgroundSpans" type='boolean' defaultValue='true'>
121128

122129
This option flags pageload/navigation spans when tabs are moved to the background with "cancelled". Because browser background tab timing is not suited for precise measurements of operations and can affect your statistics in nondeterministic ways, we recommend that this option be enabled.
123130

124-
The default is `true`.
131+
</SdkOption>
125132

126-
### enableLongTask
133+
<SdkOption name="enableLongTask" type='boolean' defaultValue='true'>
127134

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

130-
The default is `true`.
137+
</SdkOption>
131138

132-
### enableLongAnimationFrame
139+
<SdkOption name="enableLongAnimationFrame" type='boolean' defaultValue='true' availableSince='8.18.0'>
133140

134-
<Alert>
135-
The `enableLongAnimationFrame` option requires SDK [version
136-
8.18.0](https://github.com/getsentry/sentry-javascript/releases/tag/8.18.0) or
137-
higher.
138-
</Alert>
139-
140-
This option determines whether spans for long animation frames get created automatically. If both `enableLongAnimationFrame` and `enableLongTask` are enabled, Sentry will send long animation frames and fallback to long tasks (if long animation frames aren't supported by the browser).
141+
This option determines whether spans for long animation frames get created automatically. If both `enableLongAnimationFrame` and [`enableLongTask`](#enableLongTask) are enabled, Sentry will send long animation frames and fallback to long tasks (if long animation frames aren't supported by the browser).
141142

142-
The default is `true`.
143+
</SdkOption>
143144

144-
### enableInp
145-
146-
<Alert>
147-
The `enableInp` option requires SDK [version
148-
7.104.0](https://github.com/getsentry/sentry-javascript/releases/tag/7.104.0)
149-
or higher.
150-
</Alert>
145+
<SdkOption name="enableInp" type='boolean' defaultValue='true' availableSince='7.104.0'>
151146

152147
This option determines whether interactions spans automatically get created when an [Interaction to Next Paint (INP)](/product/insights/web-vitals/web-vitals-concepts/#interaction-to-next-paint-inp) event is detected. Interactions are scored and surfaced in the [Web Vitals](/product/insights/web-vitals/) module.
153148

154-
The default is `true` in `8.x` of the SDK, and `false` in `7.x`.
149+
The default is `true` starting with SDK version `8.x` and `false` in `7.x`.
155150

156151
<Alert>
157152
INP samples currently incur no cost to enable at Sentry. Basic samples contain limited information such as the interaction target, latency, and user. You may wish to enrich your INP samples by setting up [Session Replays](/platforms/javascript/session-replay/) and/or setting up [Browser Profiling](/platforms/javascript/profiling/) instrumentation around your interactive elements to gain further insights into your slowest interactions.
@@ -162,8 +157,62 @@ Please note that any Session Replays and Browser Profiles used this way will inc
162157

163158
<PlatformContent includePath="performance/enable-inp-example" />
164159

165-
### interactionsSampleRate
160+
</SdkOption>
161+
162+
<SdkOption name="interactionsSampleRate" type='number' defaultValue='1.0'>
166163

167164
This option determines the sample rate of INP spans. `interactionsSampleRate` is applied on top of `tracesSampleRate`, therefore if your `interactionsSampleRate` is set to `0.5` and your `tracesSampleRate` is set to `0.1`, the outcome will be `0.05`.
168165

169166
The default is `1.0`.
167+
168+
</SdkOption>
169+
170+
<SdkOption name="ignoreResourceSpans" type='Array<string>' defaultValue='[]' availableSince='9.23.0'>
171+
172+
This option determines which categories or resource spans should be ignored. The resource categories are the span `op`s (for example `resource.script` or `resource.img`)
173+
174+
```JavaScript
175+
Sentry.init({
176+
// ...
177+
integrations: [
178+
Sentry.browserTracingIntegration({
179+
ignoreResourceSpans: ['resource.css', 'resource.script'],
180+
}),
181+
],
182+
});
183+
```
184+
185+
By default, all resource spans are captured.
186+
187+
</SdkOption>
188+
189+
<SdkOption name="ignorePerformanceApiSpans" type='Array<string | RegExp>' defaultValue='[]' availableSince='9.23.0'>
190+
191+
This option allows you to ignore certain spans created from the following browser Performance APIs:
192+
193+
- [`performance.mark(...)`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark)
194+
- [`performance.measure(...)`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure)
195+
196+
Any mark or measure entries matching the strings or regular expressions in the passed array will not be emitted as `mark` or `measure` spans.
197+
198+
```JavaScript
199+
Sentry.init({
200+
integrations: [
201+
Sentry.browserTracingIntegration({
202+
ignorePerformanceApiSpans: ['myMeasurement', /myMark/],
203+
}),
204+
],
205+
});
206+
207+
// no spans will not be created for these:
208+
performance.mark('myMark');
209+
performance.measure('myMeasurement');
210+
211+
// spans will be created for these:
212+
performance.mark('authenticated');
213+
performance.measure('input-duration', ...);
214+
```
215+
216+
By default, all performance API spans are captured.
217+
218+
</SdkOption>

docs/product/insights/frontend/web-vitals/web-vitals-concepts.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Google considers Core Web Vitals to be the most important metrics for measuring
2424
### Interaction to Next Paint (INP)
2525

2626
<Alert>
27-
On March 12, 2024, Interaction to Next Paint (INP) replaced First Input Delay (FID) as a Core Web Vital. Prior to this, INP was an experimental metric that Sentry did not collect. To begin collecting INP measurements, make sure your JavaScript SDK version is [7.104.0](https://github.com/getsentry/sentry-javascript/releases/tag/7.104.0) or higher and that the option [`enableInp`](/platforms/javascript/tracing/instrumentation/automatic-instrumentation/#enableinp) is on.
27+
On March 12, 2024, Interaction to Next Paint (INP) replaced First Input Delay (FID) as a Core Web Vital. Prior to this, INP was an experimental metric that Sentry did not collect. To begin collecting INP measurements, make sure your JavaScript SDK version is [7.104.0](https://github.com/getsentry/sentry-javascript/releases/tag/7.104.0) or higher and that the option [`enableInp`](/platforms/javascript/tracing/instrumentation/automatic-instrumentation/#enableinp) is on (starting with version `8.0.0`, `enableInp` is enabled by default).
2828
</Alert>
2929

3030
[Interaction to Next Paint (INP)](https://web.dev/articles/inp) measures the time from when a user interacts with a page (through a click, tap, or keyboard input) to when the next paint (rendering of content on the screen) occurs. INP aims to assess how quickly users see a response from the website after taking an action, which is crucial for providing a smooth and responsive user experience.

src/components/sdkOption.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {SdkDefinition, SdkDefinitionTable} from './sdkDefinition';
99
type Props = {
1010
name: string;
1111
type: string;
12+
availableSince?: string;
1213
categorySupported?: PlatformCategory[];
1314
children?: React.ReactNode;
1415
defaultValue?: string;
@@ -19,6 +20,7 @@ export function SdkOption({
1920
name,
2021
children,
2122
type,
23+
availableSince,
2224
defaultValue,
2325
envVar,
2426
categorySupported = [],
@@ -28,9 +30,11 @@ export function SdkOption({
2830
return (
2931
<SdkDefinition name={name} categorySupported={categorySupported}>
3032
<SdkDefinitionTable>
33+
{availableSince && (
34+
<OptionDefRow label="Available since" value={availableSince} />
35+
)}
3136
{type && <OptionDefRow label="Type" value={type} />}
3237
{defaultValue && <OptionDefRow label="Default" value={defaultValue} />}
33-
3438
<PlatformCategorySection supported={['server', 'serverless']}>
3539
<PlatformSection notSupported={['javascript.nextjs']}>
3640
{envVar && <OptionDefRow label="ENV Variable" value={envVar} />}

0 commit comments

Comments
 (0)