From 0168685cace027aea02e504ac886791f9d7e7278 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Mon, 7 Jul 2025 12:42:16 +0200 Subject: [PATCH 1/3] feat(js): Document how to disable tracing --- .../common/configuration/tree-shaking.mdx | 2 +- .../javascript/common/tracing/index.mdx | 33 ++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/docs/platforms/javascript/common/configuration/tree-shaking.mdx b/docs/platforms/javascript/common/configuration/tree-shaking.mdx index 168cd8fcb3df34..29fe10525d1559 100644 --- a/docs/platforms/javascript/common/configuration/tree-shaking.mdx +++ b/docs/platforms/javascript/common/configuration/tree-shaking.mdx @@ -120,7 +120,7 @@ Replacing this flag with `false` will tree shake any SDK code that's related to `__SENTRY_TRACING__` must not be replaced with `false` when you're using any - tracing-related SDK features (for example,`Sentry.startTransaction()`). This + tracing-related SDK features (for example,`Sentry.startSpan()`). This flag is intended to be used in combination with packages like `@sentry/next` or `@sentry/sveltekit`, which automatically include the tracing functionality. diff --git a/docs/platforms/javascript/common/tracing/index.mdx b/docs/platforms/javascript/common/tracing/index.mdx index 00065d3b7c9531..7bb307d24e124d 100644 --- a/docs/platforms/javascript/common/tracing/index.mdx +++ b/docs/platforms/javascript/common/tracing/index.mdx @@ -31,12 +31,12 @@ With [tracing](/product/insights/overview/), Sentry automatically tracks your so ## Configure - Enable tracing by configuring the sampling rate for transactions. Set the - sample rate for your transactions by either: + Enable tracing by configuring the sampling rate for traces. Set the sample + rate as follows: - Enable tracing by setting the sample rate for your transactions. + Enable tracing by setting the sample rate for your traces. @@ -75,13 +75,36 @@ See Automa You can also manually start spans to instrument specific parts of your code. This is useful when you want to measure the performance of a specific operation or function. -- Tracing APIs: - Find information about APIs for custom tracing instrumentation +- Tracing APIs: Find + information about APIs for custom tracing instrumentation - Instrumentation: Find information about manual instrumentation with the Sentry SDK - Sending Span Metrics: Learn how to capture metrics on your spans +## Disabling Tracing + +If you want to disable tracing, you _should not_ set `tracesSampleRate` at +all. Setting it to `0` will not disable tracing, it will simply never send any +traces to Sentry. + + + In addition, you can configure `__SENTRY_TRACING__` to ensure the tracing code + is removed from your production build. This will result in{" "} + trace propagation{" "} + being disabled as well. See{" "} + Tree Shaking{" "} + for more information. + + ## Next Steps From d884f62a98407682bb6420f06f1880f50e64cde4 Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Wed, 9 Jul 2025 15:58:05 +0200 Subject: [PATCH 2/3] Update docs/platforms/javascript/common/tracing/index.mdx Co-authored-by: Sigrid Huemer <32902192+s1gr1d@users.noreply.github.com> --- docs/platforms/javascript/common/tracing/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/tracing/index.mdx b/docs/platforms/javascript/common/tracing/index.mdx index 7bb307d24e124d..f47f5f9fe4ecb9 100644 --- a/docs/platforms/javascript/common/tracing/index.mdx +++ b/docs/platforms/javascript/common/tracing/index.mdx @@ -97,7 +97,7 @@ traces to Sentry. "javascript.solidstart", ]} > - In addition, you can configure `__SENTRY_TRACING__` to ensure the tracing code + In addition, you can set `__SENTRY_TRACING__` to `false` to ensure the tracing code is removed from your production build. This will result in{" "} trace propagation{" "} being disabled as well. See{" "} From dea567ffb9f6fb60386e413ab2b2715c2e2aefc8 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 9 Jul 2025 15:59:45 +0200 Subject: [PATCH 3/3] more explicit --- docs/platforms/javascript/common/tracing/index.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/platforms/javascript/common/tracing/index.mdx b/docs/platforms/javascript/common/tracing/index.mdx index f47f5f9fe4ecb9..5761afcadeb795 100644 --- a/docs/platforms/javascript/common/tracing/index.mdx +++ b/docs/platforms/javascript/common/tracing/index.mdx @@ -87,6 +87,7 @@ You can also manually start spans to instrument specific parts of your code. Thi If you want to disable tracing, you _should not_ set `tracesSampleRate` at all. Setting it to `0` will not disable tracing, it will simply never send any traces to Sentry. +Instead, neither `tracesSampleRate` nor `tracesSampler` should be defined in your SDK config to fully disable tracing.