feat(tracing): Add enableTracing option#7238
Conversation
size-limit report 📦
|
Co-authored-by: Daniel Griesser <daniel.griesser.86@gmail.com>
AbhiPrasad
left a comment
There was a problem hiding this comment.
There's a couple other places in the codebase we also need to address.
sentry-javascript/packages/vue/src/sdk.ts
Line 83 in f5b7b10
|
So I moved the |
| export function hasTracingEnabled( | ||
| maybeOptions?: Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'> | undefined, | ||
| ): boolean { | ||
| if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) { |
There was a problem hiding this comment.
Hmm, I wonder if this is worth it 🤔 WDYT?
There was a problem hiding this comment.
Not sure but theoretically, rollup should be able to basically reduce this function to return false if users configure this guard in their bundler setup 🤔 So I'd argue yes
There was a problem hiding this comment.
I think the "downside" is that users that do not configure this will/may still have this code in their bundle, right?
| export function hasTracingEnabled( | ||
| maybeOptions?: Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'> | undefined, | ||
| ): boolean { | ||
| if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) { |
There was a problem hiding this comment.
Not sure but theoretically, rollup should be able to basically reduce this function to return false if users configure this guard in their bundler setup 🤔 So I'd argue yes
|
@AbhiPrasad is this good by you now as well? |
This adds a new
enableTracingoption, which can be used to streamline performance collection.truewill default thetracesSampleRatebasically to 1tracesSampleRateandtracesSampler, if they are definedThis change also moves the
hasTracingEnabledutil to@sentry/core, so we can use it everywhere in a consistent way.Closes #7065