Skip to content

feat(core): Add getSdkMetadata to Client#6643

Merged
Lms24 merged 4 commits intomasterfrom
lms-replay-getSdkMetadata
Jan 4, 2023
Merged

feat(core): Add getSdkMetadata to Client#6643
Lms24 merged 4 commits intomasterfrom
lms-replay-getSdkMetadata

Conversation

@Lms24
Copy link
Copy Markdown
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
Copy Markdown
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 lforst and mydea January 3, 2023 16:33
@Lms24 Lms24 force-pushed the lms-replay-getSdkMetadata branch from 2de4211 to 9082753 Compare January 3, 2023 16:45
@Lms24 Lms24 force-pushed the lms-replay-getSdkMetadata branch from 2dc6ae8 to c3051e7 Compare January 4, 2023 09:29
Copy link
Copy Markdown
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.

3 participants