Skip to content

Commit 4817500

Browse files
Alex KrawiecAlex Krawiec
authored andcommitted
Fix Sentry code for frontend
1 parent e38baec commit 4817500

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

docs/product/sentry-basics/distributed-tracing/initialize-sentry-sdk-frontend.mdx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,18 @@ Sentry captures data by using a platform-specific SDK that you add to your appli
5353
import * as Sentry from "@sentry/react";
5454

5555
Sentry.init({
56-
dsn: "<your_DSN_key>",
57-
integrations: [new Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
58-
59-
// Set tracesSampleRate to 1.0 to capture 100%
60-
// of transactions for performance monitoring.
61-
tracesSampleRate: 1.0,
62-
63-
// Capture Replay for 10% of all sessions,
64-
// plus for 100% of sessions with an error
65-
replaysSessionSampleRate: 0.1,
66-
replaysOnErrorSampleRate: 1.0,
56+
dsn: "your_DSN_key",
57+
integrations: [
58+
Sentry.browserTracingIntegration(),
59+
Sentry.replayIntegration(),
60+
],
61+
// Tracing
62+
tracesSampleRate: 1.0, // Capture 100% of the transactions
63+
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
64+
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
65+
// Session Replay
66+
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
67+
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
6768
});
6869
```
6970

0 commit comments

Comments
 (0)