Skip to content

ref(tracing): update hasTracingEnabled return value #4225

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

Merged
merged 4 commits into from
Dec 3, 2021

Conversation

AbhiPrasad
Copy link
Member

Experimenting with bundle size that didn't make any progress, but cherry-picked this off that branch.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2021

size-limit report

Path Base Size (111e1ff) Current Size Change
@sentry/browser - CDN Bundle (gzipped) 22.45 KB 22.45 KB +0.02% 🔺
@sentry/browser - Webpack 23.29 KB 23.29 KB 0%
@sentry/react - Webpack 23.32 KB 23.32 KB 0%
@sentry/nextjs Client - Webpack 47.98 KB 47.98 KB 0%
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 29.9 KB 29.9 KB +0.01% 🔺

Copy link
Contributor

@rhcarvalho rhcarvalho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows how the implementation could be a oneliner...

return options && ('tracesSampleRate' in options || 'tracesSampler' in options);

const tracesSampler = () => 1;
const tracesSampleRate = 1;
it.each([
['no options', undefined, false],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the output in this one case depend on the return value of getCurrentHub()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it depends on getCurrentHub, but there is no client attached to it during the test, so it works as expected.

I agree it could be a one liner, but I didn't change the function to minimize changing behaviour. I can go back and update!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@AbhiPrasad AbhiPrasad requested a review from rhcarvalho December 3, 2021 15:40
@AbhiPrasad AbhiPrasad changed the title test(tracing): Add unit test for hasTracingEnabled ref(tracing): update hasTracingEnabled return value Dec 3, 2021
@AbhiPrasad AbhiPrasad force-pushed the abhi-has-tracing-enabled-test branch from 5417ded to e4fc16a Compare December 3, 2021 15:42
@AbhiPrasad AbhiPrasad enabled auto-merge (squash) December 3, 2021 18:44
@AbhiPrasad AbhiPrasad merged commit bfd74df into master Dec 3, 2021
@AbhiPrasad AbhiPrasad deleted the abhi-has-tracing-enabled-test branch December 3, 2021 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants