From 4a7a6984ba67e0c10de023fc9bf9fbb4db51585d Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 11:23:34 +0200 Subject: [PATCH 1/2] clarify tracing docs for rr --- .../javascript.react-router.mdx | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx b/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx index 88e8e7b2cbfdc..deb7a4661c885 100644 --- a/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx +++ b/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx @@ -1,21 +1,36 @@ -```javascript +To enable automatic tracing you need to update the configuration of your client and server instrumentation: +- For client-side tracing, include the `reactRouterTracingIntegration` to your integrations array. +- Additionally you need to set the `tracesSampleRate` in your `Sentry.init()` calls. + +```javascript {tabTitle:Client} {filename:entry.client.tsx} {7,11} import * as Sentry from "@sentry/react-router"; Sentry.init({ dsn: "___PUBLIC_DSN___", - // This enables automatic instrumentation (highly recommended), - // but is not necessary for purely manual usage - // If you only want to use custom instrumentation: - // * Remove the `reactRouterTracingIntegration` integration - // * add `Sentry.addTracingExtensions()` above your Sentry.init() call + // This enables automatic instrumentation for client-side navigations integrations: [Sentry.reactRouterTracingIntegration()], // We recommend adjusting this value in production, or using tracesSampler // for finer control tracesSampleRate: 1.0, - // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled - tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], + // ... rest of your config +}); + +// ... rest of the file +``` + +```javascript {tabTitle:Server} {filename:instrument.server.(mjs|ts)} {8} +import * as Sentry from "@sentry/react-router"; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + + // We recommend adjusting this value in production, or using tracesSampler + // for finer control + tracesSampleRate: 1.0, + + // ... rest of your config }); ``` From e9818d5e2d8ca9c99cfe5d3c0adeecee84f9fd93 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 12:55:08 +0200 Subject: [PATCH 2/2] add trace propagation targets --- .../configure-sample-rate/javascript.react-router.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx b/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx index deb7a4661c885..1b7aa1acf5cb9 100644 --- a/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx +++ b/platform-includes/performance/configure-sample-rate/javascript.react-router.mdx @@ -14,6 +14,9 @@ Sentry.init({ // We recommend adjusting this value in production, or using tracesSampler // for finer control tracesSampleRate: 1.0, + + // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled + tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], // ... rest of your config });