-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(tracing): Add enableTracing option
#7238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
size-limit report 📦
|
Co-authored-by: Daniel Griesser <[email protected]>
AbhiPrasad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| if ('tracesSampleRate' in options || 'tracesSampler' in options) { |
| if (!('tracesSampleRate' in options) && !('tracesSampler' in options)) { |
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder if this is worth it 🤔 WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the "downside" is that users that do not configure this will/may still have this code in their bundle, right?
Lms24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
AbhiPrasad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
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