Skip to content
Closed
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
14 changes: 14 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,20 @@ Sentry.init({
- The experimental `_experiments.enableStandaloneClsSpans` and `_experiments.enableStandaloneLcpSpans` options were removed from both `browserTracingIntegration` and `webVitalsIntegration`. CLS and LCP are no longer configurable: they are recorded as measurements on the pageload span, unless span streaming is enabled (`traceLifecycle: 'stream'`), in which case they are sent as dedicated spans.
- INP is now always sent as a web vital span (streamed when span streaming is enabled, standalone otherwise) that carries its value as a `browser.web_vital.inp.value` attribute. Previously, with span streaming disabled, INP was sent as a standalone span that carried its value as a span measurement.

- The deprecated `enableInp` option of `browserTracingIntegration` was removed. INP is captured by default; to opt out, ignore it via the `webVitals` option.

```js
// before
Sentry.init({
integrations: [Sentry.browserTracingIntegration({ enableInp: false })],
});

// after
Sentry.init({
integrations: [Sentry.browserTracingIntegration({ webVitals: { ignore: ['inp'] } })],
});
```

- `browserTracingIntegration` no longer captures spans created by `performance.mark()` and `performance.measure()` by default. Add `userTimingIntegration()` to continue capturing them. The `ignorePerformanceApiSpans` option moved to the new integration as `ignore`.

```js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Sentry.init({
Sentry.browserTracingIntegration({
linkPreviousTrace: 'in-memory',
consistentTraceSampling: true,
enableInp: false,
webVitals: { ignore: ['inp'] },
}),
Sentry.spanStreamingIntegration(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sentry.init({
Sentry.browserTracingIntegration({
linkPreviousTrace: 'in-memory',
consistentTraceSampling: true,
enableInp: false,
webVitals: { ignore: ['inp'] },
}),
],
tracePropagationTargets: ['sentry-test-external.io'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sentry.init({
enableLongTask: false,
enableLongAnimationFrame: true,
instrumentPageLoad: false,
enableInp: false,
webVitals: { ignore: ['inp'] },
}),
Sentry.spanStreamingIntegration(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sentry.init({
enableLongTask: false,
enableLongAnimationFrame: true,
instrumentPageLoad: false,
enableInp: false,
webVitals: { ignore: ['inp'] },
}),
],
tracesSampleRate: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sentry.init({
enableLongAnimationFrame: false,
instrumentPageLoad: false,
instrumentNavigation: true,
enableInp: false,
webVitals: { ignore: ['inp'] },
enableLongTask: true,
}),
Sentry.spanStreamingIntegration(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sentry.init({
enableLongAnimationFrame: false,
instrumentPageLoad: false,
instrumentNavigation: true,
enableInp: false,
webVitals: { ignore: ['inp'] },
enableLongTask: true,
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Sentry.init({
Sentry.browserTracingIntegration({
idleTimeout: 4000,
enableLongTask: false,
enableInp: true,
instrumentPageLoad: false,
instrumentNavigation: false,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Sentry.init({
integrations: [
Sentry.browserTracingIntegration({
enableLongTask: false,
enableInp: true,
instrumentPageLoad: false,
instrumentNavigation: false,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Sentry.init({
Sentry.browserTracingIntegration({
idleTimeout: 1000,
enableLongTask: false,
enableInp: true,
instrumentPageLoad: false,
instrumentNavigation: false,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Sentry.init({
integrations: [
Sentry.browserTracingIntegration({
enableLongTask: false,
enableInp: true,
instrumentPageLoad: false,
instrumentNavigation: false,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Sentry.init({
Sentry.browserTracingIntegration({
idleTimeout: 4000,
enableLongTask: false,
enableInp: true,
instrumentPageLoad: false,
instrumentNavigation: false,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Sentry.init({
Sentry.browserTracingIntegration({
idleTimeout: 4000,
enableLongTask: false,
enableInp: true,
instrumentPageLoad: false,
instrumentNavigation: false,
}),
Expand Down
21 changes: 1 addition & 20 deletions packages/browser/src/tracing/browserTracingIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ export interface BrowserTracingOptions {
*/
enableLongAnimationFrame: boolean;

/**
* If true, Sentry will capture first input delay and add it to the corresponding transaction.
*
* Default: true
*
* @deprecated Use {@link BrowserTracingOptions.webVitals} instead: `webVitals: { ignore: ['inp'] }`.
*/
enableInp: boolean;

/**
* Options for the `webVitalsIntegration` that is auto-registered when none is present.
* Ignored if you register `webVitalsIntegration` yourself.
Expand Down Expand Up @@ -268,8 +259,6 @@ const DEFAULT_BROWSER_TRACING_OPTIONS: BrowserTracingOptions = {
markBackgroundSpan: true,
enableLongTask: true,
enableLongAnimationFrame: true,
// oxlint-disable-next-line typescript/no-deprecated -- still honoured until it is removed
enableInp: true,
ignoreResourceSpans: [],
detectRedirects: true,
linkPreviousTrace: 'in-memory',
Expand Down Expand Up @@ -304,8 +293,6 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
const optionalWindowDocument = WINDOW.document as (typeof WINDOW)['document'] | undefined;

const {
// oxlint-disable-next-line typescript/no-deprecated -- still honoured until it is removed
enableInp,
enableLongTask,
enableLongAnimationFrame,
webVitals,
Expand Down Expand Up @@ -607,13 +594,7 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
// afterAllSetup so that a user-provided webVitalsIntegration - which may be ordered after
// browserTracingIntegration in the integrations array - has already been installed.
if (client.addIntegration && !client.getIntegrationByName?.(WEB_VITALS_INTEGRATION_NAME)) {
const ignore = webVitals?.ignore ?? [];
client.addIntegration(
webVitalsIntegration({
...webVitals,
ignore: enableInp || ignore.includes('inp') ? ignore : [...ignore, 'inp'],
}),
);
client.addIntegration(webVitalsIntegration(webVitals));
}

let startingUrl: string | undefined = getLocationHref();
Expand Down
20 changes: 5 additions & 15 deletions packages/browser/test/tracing/browserTracingIntegration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,37 +211,27 @@ describe('browserTracingIntegration', () => {
const client = new BrowserClient(
getDefaultBrowserClientOptions({
tracesSampleRate: 1,
integrations: [browserTracingIntegration({ webVitals: { softNavigations: false } })],
integrations: [browserTracingIntegration({ webVitals: { softNavigations: false, ignore: ['inp'] } })],
}),
);
setCurrentClient(client);
client.init();

expect(webVitalsSpy).toHaveBeenCalledWith(expect.objectContaining({ softNavigations: false }));
expect(webVitalsSpy).toHaveBeenCalledWith(expect.objectContaining({ softNavigations: false, ignore: ['inp'] }));
});

it.each([
['leaves the ignore list alone when INP is enabled', {}, []],
// oxlint-disable-next-line typescript/no-deprecated
['appends inp to the ignore list when disabled', { enableInp: false }, ['inp']],
[
'keeps user-provided entries when appending inp',
// oxlint-disable-next-line typescript/no-deprecated
{ enableInp: false, webVitals: { ignore: ['cls' as const] } },
['cls', 'inp'],
],
])('enableInp %s', (_name, options, expected) => {
it('does not ignore any web vital by default', () => {
const webVitalsSpy = vi.spyOn(webVitalsModule, 'webVitalsIntegration');
const client = new BrowserClient(
getDefaultBrowserClientOptions({
tracesSampleRate: 1,
integrations: [browserTracingIntegration(options)],
integrations: [browserTracingIntegration()],
}),
);
setCurrentClient(client);
client.init();

expect(webVitalsSpy).toHaveBeenCalledWith(expect.objectContaining({ ignore: expected }));
expect(webVitalsSpy).toHaveBeenCalledWith(undefined);
});

it('works with tracing disabled', () => {
Expand Down
Loading