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
feat(tracing): Add enableTracing
option
#7238
Conversation
size-limit report 📦
|
Co-authored-by: Daniel Griesser <daniel.griesser.86@gmail.com>
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?
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? |
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
enableTracing
option, which can be used to streamline performance collection.true
will default thetracesSampleRate
basically to 1tracesSampleRate
andtracesSampler
, if they are definedThis change also moves the
hasTracingEnabled
util to@sentry/core
, so we can use it everywhere in a consistent way.Closes #7065