Skip to content
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(core): Add getSdkMetadata to Client #6643

Merged
merged 4 commits into from Jan 4, 2023
Merged

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 3, 2023

This PR adds a new method to the Client interface: getSdkMetadata.
We can use this method in the Replay package to avoid accessing client.getOptions()._metadata, which previously caused broken CDN bundles which we hot-fixed with #6600. This PR now properly fixes this issue by simply not accessing this "private" field anymore.

Since adding a new method to the Client Interface is a breaking change, I made it an optional method, which should avoid breakage. We should consider making this method required in v8.

I tested the Replay CDN bundles with this change to ensure that we still send events.

Note: I'm curious about the bundle size impact here, for example, if the added cost is ammortized by mangling _metadata now again. Hence leaving this as a draft for now.
So, turns out, there is a size increase but given that it seems to be <0.1% I'd vote to go forward with this change.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.8 KB (+0.04% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 61.31 KB (+0.04% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.59 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.88 KB (-0.01% 🔽)
@sentry/browser - Webpack (gzipped + minified) 20.35 KB (+0.05% 🔺)
@sentry/browser - Webpack (minified) 66.5 KB (+0.08% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.37 KB (+0.05% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.62 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.77 KB (+0.06% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.21 KB (+0.04% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43 KB (+0.04% 🔺)
@sentry/replay - Webpack (gzipped + minified) 37.69 KB (+0.03% 🔺)

@Lms24 Lms24 marked this pull request as ready for review January 3, 2023 16:33
@Lms24 Lms24 requested review from mydea and lforst January 3, 2023 16:33
packages/types/src/client.ts Outdated Show resolved Hide resolved
Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@Lms24 Lms24 merged commit c157f86 into master Jan 4, 2023
@Lms24 Lms24 deleted the lms-replay-getSdkMetadata branch January 4, 2023 09:51
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.

None yet

3 participants