Skip to content

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Sep 18, 2025

Quick PR to streamline the stack frame module_metadata property assignment (addMetadataToStackFrames) and cleanup (stripMetadataFromStackFrames) logic, since we can use optional chaining now without a bundle size hit from polyfilling.

Originally went with moving the cleanup logic into the client but decided against it due to the bundle size hit (see comment).

Copy link
Contributor

github-actions bot commented Sep 18, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.22 kB - -
@sentry/browser - with treeshaking flags 22.74 kB - -
@sentry/browser (incl. Tracing) 40.23 kB - -
@sentry/browser (incl. Tracing, Replay) 78.6 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.27 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 83.26 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 95.49 kB - -
@sentry/browser (incl. Feedback) 40.94 kB - -
@sentry/browser (incl. sendFeedback) 28.88 kB - -
@sentry/browser (incl. FeedbackAsync) 33.78 kB - -
@sentry/react 25.93 kB - -
@sentry/react (incl. Tracing) 42.23 kB - -
@sentry/vue 28.71 kB - -
@sentry/vue (incl. Tracing) 42.04 kB - -
@sentry/svelte 24.24 kB - -
CDN Bundle 25.75 kB - -
CDN Bundle (incl. Tracing) 40.05 kB - -
CDN Bundle (incl. Tracing, Replay) 76.28 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 81.78 kB - -
CDN Bundle - uncompressed 75.23 kB - -
CDN Bundle (incl. Tracing) - uncompressed 118.58 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 233.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 246.47 kB - -
@sentry/nextjs (client) 44.23 kB - -
@sentry/sveltekit (client) 40.66 kB - -
@sentry/node-core 49.96 kB -0.01% -1 B 🔽
@sentry/node 151.25 kB - -
@sentry/node - without tracing 91.86 kB -0.01% -1 B 🔽
@sentry/aws-serverless 105.31 kB - -

View base workflow run

Copy link
Contributor

github-actions bot commented Sep 18, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,771 - 9,262 -5%
GET With Sentry 1,326 15% 1,394 -5%
GET With Sentry (error only) 5,901 67% 5,999 -2%
POST Baseline 1,174 - 1,179 -0%
POST With Sentry 512 44% 560 -9%
POST With Sentry (error only) 1,038 88% 1,061 -2%
MYSQL Baseline 3,281 - 3,310 -1%
MYSQL With Sentry 391 12% 421 -7%
MYSQL With Sentry (error only) 2,626 80% 2,677 -2%

View base workflow run

name: 'ThirdPartyErrorsFilter',
setup(client) {
// We need to strip metadata from stack frames before sending them to Sentry since these are client side only.
// TODO(lforst): Move this cleanup logic into a more central place in the SDK.
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to remove this TODO because for now, we only call this cleanup in the two optional integrations. So moving this to client would allow us to get rid of the double-hook registration but at the same time penalize the core bundle size for something users likely don't use. We can revisit and extract it once this logic is used in a default integration but I don't think there's much benefit in doing it now.

@Lms24 Lms24 self-assigned this Sep 18, 2025
@Lms24 Lms24 changed the title ref(core): Streamling stripMetadataFromStackFrames calls ref(core): Streamline module_metadata assignment and cleanup functions Sep 18, 2025
@Lms24 Lms24 changed the title ref(core): Streamline module_metadata assignment and cleanup functions ref(core): Streamline module_metadata assignment and cleanup functions Sep 18, 2025
@Lms24 Lms24 marked this pull request as ready for review September 18, 2025 11:35
@Lms24 Lms24 requested review from a team, mydea and RulaKhaled and removed request for a team September 18, 2025 11:35
Copy link
Member

@RulaKhaled RulaKhaled left a comment

Choose a reason for hiding this comment

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

nice

@Lms24 Lms24 merged commit 804f7a7 into develop Sep 19, 2025
367 of 369 checks passed
@Lms24 Lms24 deleted the lms/ref-core-stripMetadataFromStackFrames branch September 19, 2025 10:03
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