Skip to content

Conversation

RulaKhaled
Copy link
Member

Fixes: #17809

Implements message truncation logic that uses binary search to drop oldest messages first until the payload fits within the 20KB limit. If a single message exceeds the limit, its content is truncated from the end. Supports OpenAI/Anthropic ({ role, content }) and Google GenAI ({ role, parts: [{ text }] }) message formats.

@RulaKhaled RulaKhaled marked this pull request as draft October 13, 2025 14:56
Copy link
Contributor

github-actions bot commented Oct 13, 2025

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 24.48 kB - -
@sentry/browser - with treeshaking flags 22.96 kB - -
@sentry/browser (incl. Tracing) 40.67 kB - -
@sentry/browser (incl. Tracing, Replay) 79.03 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.69 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 83.72 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 95.9 kB - -
@sentry/browser (incl. Feedback) 41.17 kB - -
@sentry/browser (incl. sendFeedback) 29.14 kB - -
@sentry/browser (incl. FeedbackAsync) 34.05 kB - -
@sentry/react 26.19 kB - -
@sentry/react (incl. Tracing) 42.62 kB - -
@sentry/vue 28.99 kB - -
@sentry/vue (incl. Tracing) 42.44 kB - -
@sentry/svelte 24.51 kB - -
CDN Bundle 26.7 kB - -
CDN Bundle (incl. Tracing) 41.22 kB - -
CDN Bundle (incl. Tracing, Replay) 77.53 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 82.98 kB - -
CDN Bundle - uncompressed 78.33 kB - -
CDN Bundle (incl. Tracing) - uncompressed 122.33 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 237.49 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 250.25 kB - -
@sentry/nextjs (client) 44.71 kB - -
@sentry/sveltekit (client) 41.05 kB - -
@sentry/node-core 50.8 kB - -
@sentry/node 154.92 kB +0.33% +502 B 🔺
@sentry/node - without tracing 92.67 kB - -
@sentry/aws-serverless 106.38 kB - -

View base workflow run

Copy link
Contributor

github-actions bot commented Oct 13, 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.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,975 - 8,966 +0%
GET With Sentry 1,430 16% 1,412 +1%
GET With Sentry (error only) 6,200 69% 6,242 -1%
POST Baseline 1,198 - 1,211 -1%
POST With Sentry 507 42% 531 -5%
POST With Sentry (error only) 1,045 87% 1,089 -4%
MYSQL Baseline 3,277 - 3,373 -3%
MYSQL With Sentry 395 12% 484 -18%
MYSQL With Sentry (error only) 2,745 84% 2,768 -1%

View base workflow run

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.

Implement Byte Size Limit and Oldest First Truncation for gen_ai.*.messages

1 participant