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: Always truncate stored breadcrumb messages to 2kb #15819

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

lforst
Copy link
Member

@lforst lforst commented Mar 25, 2025

We had this logic in the console instrumentation before but it probably makes sense to truncate all breadcrumbs to some degree for memory consumption reasons.

Acts as prework for #15818 because if we don't truncate error messages they will end up as very big strings in breadcrumbs.

@lforst lforst self-assigned this Mar 25, 2025
Copy link
Contributor

github-actions bot commented Mar 25, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.23 KB +0.08% +18 B 🔺
@sentry/browser - with treeshaking flags 23.03 KB +0.08% +17 B 🔺
@sentry/browser (incl. Tracing) 36.63 KB +0.05% +18 B 🔺
@sentry/browser (incl. Tracing, Replay) 73.8 KB +0.03% +17 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.13 KB +0.03% +17 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 78.44 KB +0.03% +18 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 91.02 KB +0.03% +25 B 🔺
@sentry/browser (incl. Feedback) 40.35 KB +0.05% +17 B 🔺
@sentry/browser (incl. sendFeedback) 27.86 KB +0.07% +18 B 🔺
@sentry/browser (incl. FeedbackAsync) 32.65 KB +0.05% +16 B 🔺
@sentry/react 25.02 KB +0.07% +17 B 🔺
@sentry/react (incl. Tracing) 38.53 KB +0.05% +18 B 🔺
@sentry/vue 27.46 KB +0.07% +17 B 🔺
@sentry/vue (incl. Tracing) 38.31 KB +0.05% +16 B 🔺
@sentry/svelte 23.26 KB +0.08% +19 B 🔺
CDN Bundle 24.45 KB +0.09% +22 B 🔺
CDN Bundle (incl. Tracing) 36.64 KB +0.04% +14 B 🔺
CDN Bundle (incl. Tracing, Replay) 71.63 KB +0.03% +15 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 76.83 KB +0.02% +13 B 🔺
CDN Bundle - uncompressed 71.43 KB +0.07% +46 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 108.62 KB +0.05% +47 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 219.88 KB +0.03% +47 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 232.44 KB +0.02% +47 B 🔺
@sentry/nextjs (client) 39.82 KB +0.05% +17 B 🔺
@sentry/sveltekit (client) 37.04 KB +0.05% +16 B 🔺
@sentry/node 142.87 KB +0.01% +12 B 🔺
@sentry/node - without tracing 96.25 KB +0.01% +7 B 🔺
@sentry/aws-serverless 120.6 KB +0.01% +6 B 🔺

View base workflow run

@lforst lforst marked this pull request as ready for review March 25, 2025 13:13
@lforst lforst requested review from mydea and chargome March 25, 2025 13:13
@lforst lforst requested review from AbhiPrasad and s1gr1d March 26, 2025 12:18
timestamp: dateTimestampInSeconds(),
...breadcrumb,
// Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory
message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message,
Copy link
Member

@s1gr1d s1gr1d Mar 26, 2025

Choose a reason for hiding this comment

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

Should we maybe provide an option for people to overwrite this value of 2kb?

Like maxMessageLength as option in the breadcrumb integration.

Copy link
Member Author

Choose a reason for hiding this comment

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

We didn't have this option before and nobody asked for it so I would say no.

@lforst lforst merged commit 7191ebd into develop Mar 26, 2025
155 of 156 checks passed
@lforst lforst deleted the lforst-blanket-truncate-breadcrumbs branch March 26, 2025 14:42
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