Skip to content

Commit d286236

Browse files
authored
ref(js): Update and fix browser profiling integration code snippets (#9116)
1 parent 5f6bc82 commit d286236

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

platform-includes/profiling/automatic-instrumentation-setup/_default.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Sentry.init({
55
dsn: "___PUBLIC_DSN___",
66
integrations: [
77
// Add browser profiling integration to the list of integrations
8-
new Sentry.BrowserTracing(),
9-
new Sentry.BrowserProfilingIntegration(),
8+
Sentry.browserTracingIntegration(),
9+
Sentry.browserProfilingIntegration(),
1010
],
1111

1212
// Set tracesSampleRate to 1.0 to capture 100%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
```javascript
2+
import * as Sentry from "@sentry/astro";
3+
4+
Sentry.init({
5+
dsn: "___PUBLIC_DSN___",
6+
integrations: [
7+
// Add browser profiling integration to the list of integrations
8+
Sentry.browserProfilingIntegration(),
9+
],
10+
11+
// Set tracesSampleRate to 1.0 to capture 100%
12+
// of transactions for performance monitoring.
13+
// We recommend adjusting this value in production
14+
tracesSampleRate: 1.0,
15+
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
16+
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
17+
18+
// Set profilesSampleRate to 1.0 to profile every transaction.
19+
// Since profilesSampleRate is relative to tracesSampleRate,
20+
// the final profiling rate can be computed as tracesSampleRate * profilesSampleRate
21+
// For example, a tracesSampleRate of 0.5 and profilesSampleRate of 0.5 would
22+
// results in 25% of transactions being profiled (0.5*0.5=0.25)
23+
profilesSampleRate: 1.0,
24+
});
25+
```

platform-includes/profiling/automatic-instrumentation-setup/javascript.react.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Sentry.init({
55
dsn: "___PUBLIC_DSN___",
66
integrations: [
77
// Add browser profiling integration to the list of integrations
8-
Sentry.browserTracingIntegration(),
9-
Sentry.browserTracingIntegration(),
8+
Sentry.browserTracingIntegration(),
9+
Sentry.browserProfilingIntegration(),
1010
],
1111

1212
// Set tracesSampleRate to 1.0 to capture 100%

platform-includes/profiling/automatic-instrumentation-setup/javascript.remix.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Sentry.init({
55
dsn: "___PUBLIC_DSN___",
66
integrations: [
77
// Add browser profiling integration to the list of integrations
8-
new Sentry.BrowserProfilingIntegration(),
8+
Sentry.browserTracingIntegration(),
9+
Sentry.browserProfilingIntegration(),
910
],
1011

1112
// Set tracesSampleRate to 1.0 to capture 100%

platform-includes/profiling/automatic-instrumentation-setup/javascript.sveltekit.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Sentry.init({
55
dsn: "___PUBLIC_DSN___",
66
integrations: [
77
// Add browser profiling integration to the list of integrations
8-
new Sentry.BrowserProfilingIntegration(),
8+
Sentry.browserProfilingIntegration(),
99
],
1010

1111
// Set tracesSampleRate to 1.0 to capture 100%

0 commit comments

Comments
 (0)