Skip to content

Commit ec4387d

Browse files
mydeas1gr1d
andauthored
feat(js): Document how to disable tracing (#14268)
Closes #14267 This adds more explicit docs explaining how to disable tracing, as this sometimes is confusing for folks. --------- Co-authored-by: Sigrid Huemer <32902192+s1gr1d@users.noreply.github.com>
1 parent 504596d commit ec4387d

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

docs/platforms/javascript/common/configuration/tree-shaking.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Replacing this flag with `false` will tree shake any SDK code that's related to
120120

121121
<Alert>
122122
`__SENTRY_TRACING__` must not be replaced with `false` when you're using any
123-
tracing-related SDK features (for example,`Sentry.startTransaction()`). This
123+
tracing-related SDK features (for example,`Sentry.startSpan()`). This
124124
flag is intended to be used in combination with packages like `@sentry/next`
125125
or `@sentry/sveltekit`, which automatically include the tracing functionality.
126126
</Alert>

docs/platforms/javascript/common/tracing/index.mdx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ With [tracing](/product/insights/overview/), Sentry automatically tracks your so
3131
## Configure
3232

3333
<PlatformSection supported={["javascript"]}>
34-
Enable tracing by configuring the sampling rate for transactions. Set the
35-
sample rate for your transactions by either:
34+
Enable tracing by configuring the sampling rate for traces. Set the sample
35+
rate as follows:
3636
</PlatformSection>
3737

3838
<PlatformSection notSupported={["javascript"]}>
39-
Enable tracing by setting the sample rate for your transactions.
39+
Enable tracing by setting the sample rate for your traces.
4040
</PlatformSection>
4141

4242
<PlatformContent includePath="performance/configure-sample-rate" />
@@ -75,13 +75,37 @@ See <PlatformLink to="/tracing/instrumentation/automatic-instrumentation">Automa
7575

7676
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.
7777

78-
- <PlatformLink to="/apis/#tracing">Tracing APIs</PlatformLink>:
79-
Find information about APIs for custom tracing instrumentation
78+
- <PlatformLink to="/apis/#tracing">Tracing APIs</PlatformLink>: Find
79+
information about APIs for custom tracing instrumentation
8080
- <PlatformLink to="/tracing/instrumentation/">Instrumentation</PlatformLink>:
8181
Find information about manual instrumentation with the Sentry SDK
8282
- <PlatformLink to="/tracing/span-metrics/">Sending Span Metrics</PlatformLink>:
8383
Learn how to capture metrics on your spans
8484

85+
## Disabling Tracing
86+
87+
If you want to disable tracing, you _should not_ set `tracesSampleRate` at
88+
all. Setting it to `0` will not disable tracing, it will simply never send any
89+
traces to Sentry.
90+
Instead, neither `tracesSampleRate` nor `tracesSampler` should be defined in your SDK config to fully disable tracing.
91+
92+
<PlatformSection
93+
supported={[
94+
"javascript.nextjs",
95+
"javascript.nuxt",
96+
"javascript.sveltekit",
97+
"javascript.astro",
98+
"javascript.solidstart",
99+
]}
100+
>
101+
In addition, you can set `__SENTRY_TRACING__` to `false` to ensure the tracing code
102+
is removed from your production build. This will result in{" "}
103+
<PlatformLink to="/tracing/distributed-tracing/">trace propagation</PlatformLink>{" "}
104+
being disabled as well. See{" "}
105+
<PlatformLink to="/configuration/tree-shaking/">Tree Shaking</PlatformLink>{" "}
106+
for more information.
107+
</PlatformSection>
108+
85109
## Next Steps
86110

87111
<PageGrid />

0 commit comments

Comments
 (0)