Skip to content

Commit b3a9291

Browse files
AbhiPrasadlobsterkatie
authored andcommitted
Update BrowserTracing import for tree shaking
In getsentry/sentry-javascript#4204 we updated the `BrowserTracing` import in the JS SDK to be exported individually. We want users to use this individual import so that the other integrations are treeshaken. This patch updates our documentation to import `BrowserTracing` directly from `@sentry/tracing` instead of through the `Integrations` object, which hopefully should lead to a bundle size reduction for people.
1 parent 2c50eb4 commit b3a9291

File tree

22 files changed

+58
-59
lines changed

22 files changed

+58
-59
lines changed

src/includes/getting-started-config/javascript.angular.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Once this is done, Sentry's Angular SDK captures all unhandled exceptions and tr
44
import { enableProdMode } from "@angular/core";
55
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
66
import * as Sentry from "@sentry/angular";
7-
import { Integrations } from "@sentry/tracing";
7+
import { BrowserTracing } from "@sentry/tracing";
88
import { AppModule } from "./app/app.module";
99

1010
Sentry.init({
@@ -13,7 +13,7 @@ Sentry.init({
1313
// Registers and configures the Tracing integration,
1414
// which automatically instruments your application to monitor its
1515
// performance, including custom Angular routing instrumentation
16-
new Integrations.BrowserTracing({
16+
new BrowserTracing({
1717
tracingOrigins: ["localhost", "https://yourserver.io/api"],
1818
routingInstrumentation: Sentry.routingInstrumentation,
1919
}),

src/includes/getting-started-config/javascript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Once this is done, Sentry's JavaScript SDK captures all unhandled exceptions and
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { Integrations } from "@sentry/tracing";
5+
import { BrowserTracing } from "@sentry/tracing";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
99

1010
// Alternatively, use `process.env.npm_package_version` for a dynamic release version
1111
// if your build tool supports it.
1212
release: "[email protected]",
13-
integrations: [new Integrations.BrowserTracing()],
13+
integrations: [new BrowserTracing()],
1414

1515
// Set tracesSampleRate to 1.0 to capture 100%
1616
// of transactions for performance monitoring.

src/includes/getting-started-config/javascript.react.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import React from "react";
33
import ReactDOM from "react-dom";
44
import * as Sentry from "@sentry/react";
5-
import { Integrations } from "@sentry/tracing";
5+
import { BrowserTracing } from "@sentry/tracing";
66
import App from "./App";
77

88
Sentry.init({
99
dsn: "___PUBLIC_DSN___",
10-
integrations: [new Integrations.BrowserTracing()],
10+
integrations: [new BrowserTracing()],
1111

1212
// We recommend adjusting this value in production, or using tracesSampler
1313
// for finer control

src/includes/getting-started-config/javascript.vue.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ To initialize Sentry in your Vue application, add this to your `app.js`:
66
import Vue from "vue";
77
import Router from "vue-router";
88
import * as Sentry from "@sentry/vue";
9-
import { Integrations } from "@sentry/tracing";
9+
import { BrowserTracing } from "@sentry/tracing";
1010

1111
Vue.use(Router);
1212

@@ -18,7 +18,7 @@ Sentry.init({
1818
Vue,
1919
dsn: "___PUBLIC_DSN___",
2020
integrations: [
21-
new Integrations.BrowserTracing({
21+
new BrowserTracing({
2222
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
2323
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
2424
}),
@@ -43,7 +43,7 @@ new Vue({
4343
import { createApp } from "vue";
4444
import { createRouter } from "vue-router";
4545
import * as Sentry from "@sentry/vue";
46-
import { Integrations } from "@sentry/tracing";
46+
import { BrowserTracing } from "@sentry/tracing";
4747

4848
const app = createApp({
4949
// ...
@@ -56,7 +56,7 @@ Sentry.init({
5656
app,
5757
dsn: "___PUBLIC_DSN___",
5858
integrations: [
59-
new Integrations.BrowserTracing({
59+
new BrowserTracing({
6060
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
6161
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
6262
}),

src/includes/performance/beforeNavigate-example/javascript.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ One common use case is parameterizing transaction names. For both `pageload` and
44
Sentry.init({
55
// ...
66
integrations: [
7-
new Integrations.BrowserTracing({
7+
new BrowserTracing({
88
beforeNavigate: context => {
99
return {
1010
...context,

src/includes/performance/beforeNavigate-example/javascript.nextjs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Sentry.init({
33
// ...
44
integrations: [
5-
new Sentry.Integrations.BrowserTracing({
5+
new BrowserTracing({
66
beforeNavigate: context => {
77
return {
88
...context,

src/includes/performance/configure-sample-rate/javascript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import * as Sentry from "@sentry/browser";
55

66
// If taking advantage of automatic instrumentation (highly recommended)
7-
import { Integrations as TracingIntegrations } from "@sentry/tracing";
7+
import { BrowserTracing } from "@sentry/tracing";
88
// Or, if only manually tracing
99
// import * as _ from "@sentry/tracing"
1010
// Note: You MUST import the package in some way for tracing to work
@@ -14,7 +14,7 @@ Sentry.init({
1414

1515
// This enables automatic instrumentation (highly recommended), but is not
1616
// necessary for purely manual usage
17-
integrations: [new TracingIntegrations.BrowserTracing()],
17+
integrations: [new BrowserTracing()],
1818

1919
// To set a uniform sample rate
2020
tracesSampleRate: 0.2

src/includes/performance/configure-sample-rate/javascript.react.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as Sentry from "@sentry/react";
33

44
// If taking advantage of automatic instrumentation (highly recommended)
5-
import { Integrations as TracingIntegrations } from "@sentry/tracing";
5+
import { BrowserTracing } from "@sentry/tracing";
66
// Or, if only manually tracing
77
// import * as _ from "@sentry/tracing"
88
// Note: You MUST import the package in some way for tracing to work
@@ -12,12 +12,12 @@ Sentry.init({
1212

1313
// This enables automatic instrumentation (highly recommended), but is not
1414
// necessary for purely manual usage
15-
integrations: [new TracingIntegrations.BrowserTracing()],
15+
integrations: [new BrowserTracing()],
1616

1717
// To set a uniform sample rate
1818
tracesSampleRate: 0.2
1919

2020
// Alternatively, to control sampling dynamically
2121
tracesSampler: samplingContext => { ... }
2222
});
23-
```
23+
```

src/includes/performance/configure-sample-rate/javascript.vue.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Vue from "vue";
33
import * as Sentry from "@sentry/vue";
44

55
// If taking advantage of automatic instrumentation (highly recommended)
6-
import { Integrations } from "@sentry/tracing";
6+
import { BrowserTracing } from "@sentry/tracing";
77
// Or, if only manually tracing
88
// import * as _ from "@sentry/tracing"
99
// Note: You MUST import the package in some way for tracing to work
@@ -15,7 +15,7 @@ Sentry.init({
1515

1616
// This enables automatic instrumentation (highly recommended), but is not
1717
// necessary for purely manual usage
18-
integrations: [new Integrations.BrowserTracing()],
18+
integrations: [new BrowserTracing],
1919

2020
// To set a uniform sample rate
2121
tracesSampleRate: 0.2

src/includes/performance/enable-automatic-instrumentation/javascript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ After configuration, you will see both `pageload` and `navigation` transactions
66
// If you're using one of our integration packages, like `@sentry/angular`,
77
// substitute its name for `@sentry/browser` here
88
import * as Sentry from "@sentry/browser";
9-
import { Integrations as TracingIntegrations } from "@sentry/tracing"; // Must import second
9+
import { BrowserTracing } from "@sentry/tracing"; // Must import second
1010

1111
Sentry.init({
1212
dsn: "___PUBLIC_DSN___",
1313

1414
integrations: [
15-
new TracingIntegrations.BrowserTracing({
15+
new BrowserTracing({
1616
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
1717
// ... other options
1818
}),

0 commit comments

Comments
 (0)