Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.0.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
const config = await dynamicallyLoadConfigSomehow();
Sentry.init({
tracesSampleRate: config.sentryTracesSampleRate ?? undefined
});
Steps to Reproduce
- Add logs to
import-in-the-middle
so that you can tell when it's being imported. - Initialize Sentry with
tracesSampleRate: undefined
. - Observe that even though I don't want Sentry to enable any tracing instrumentation,
import-in-the-middle
is still loaded by Sentry and instrumentation is still added.
Expected Result
I would expect that an undefined value for tracesSampleRate
would be interpreted as "don't enable tracing".
Actual Result
The mere existence of a tracesSampleRate
value in the Sentry init options, regardless of what the value is, is interpreted as "enable tracing instrumentation":
I think that check should probably look more like this:
return !!options && (options.enableTracing || options.tracesSampleRate != undefined || options.tracesSampler != undefined);
I'd be happy to open a PR with this if a maintainer can give the go-ahead!
Metadata
Metadata
Assignees
Type
Projects
Status
No status