Skip to content

fix(core): Replace global interval with trace-specific interval based flushing#19686

Merged
Lms24 merged 2 commits intolms/feat-span-firstfrom
lms/fix-core-spanbuffer-flush-interval-by-trace
Mar 9, 2026
Merged

fix(core): Replace global interval with trace-specific interval based flushing#19686
Lms24 merged 2 commits intolms/feat-span-firstfrom
lms/fix-core-spanbuffer-flush-interval-by-trace

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Mar 6, 2026

As discussed yesterday with @cleptric, we don't want a global interval-based flushing but the interval shall be set per trace bucket. This PR makes that change.

@Lms24 Lms24 changed the base branch from develop to lms/feat-span-first March 6, 2026 14:40
@Lms24 Lms24 requested review from JPeer264 and s1gr1d March 6, 2026 14:42
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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 25.71 kB +0.34% +87 B 🔺
@sentry/browser - with treeshaking flags 24.21 kB +0.32% +76 B 🔺
@sentry/browser (incl. Tracing) 42.72 kB +0.68% +285 B 🔺
@sentry/browser (incl. Tracing, Profiling) 47.4 kB +0.65% +306 B 🔺
@sentry/browser (incl. Tracing, Replay) 81.56 kB +0.39% +309 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.17 kB +0.42% +295 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 86.24 kB +0.34% +290 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 98.48 kB +0.29% +277 B 🔺
@sentry/browser (incl. Feedback) 42.51 kB +0.17% +69 B 🔺
@sentry/browser (incl. sendFeedback) 30.38 kB +0.28% +83 B 🔺
@sentry/browser (incl. FeedbackAsync) 35.43 kB +0.22% +77 B 🔺
@sentry/browser (incl. Metrics) 26.87 kB +0.28% +75 B 🔺
@sentry/browser (incl. Logs) 27.02 kB +0.29% +78 B 🔺
@sentry/browser (incl. Metrics & Logs) 27.69 kB +0.29% +80 B 🔺
@sentry/react 27.47 kB +0.33% +88 B 🔺
@sentry/react (incl. Tracing) 45.07 kB +0.67% +297 B 🔺
@sentry/vue 30.37 kB +0.98% +293 B 🔺
@sentry/vue (incl. Tracing) 44.59 kB +0.67% +294 B 🔺
@sentry/svelte 25.74 kB +0.32% +82 B 🔺
CDN Bundle 28.24 kB +0.24% +65 B 🔺
CDN Bundle (incl. Tracing) 43.56 kB +0.71% +303 B 🔺
CDN Bundle (incl. Logs, Metrics) 29.07 kB +0.22% +63 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 44.41 kB +0.7% +305 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 68.17 kB +0.13% +84 B 🔺
CDN Bundle (incl. Tracing, Replay) 80.4 kB +0.33% +263 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.3 kB +0.37% +297 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 85.94 kB +0.34% +284 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.83 kB +0.35% +297 B 🔺
CDN Bundle - uncompressed 82.55 kB +0.24% +196 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 128.93 kB +0.68% +863 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.38 kB +0.24% +196 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.76 kB +0.66% +863 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.05 kB +0.1% +196 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.81 kB +0.36% +863 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.63 kB +0.35% +863 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.73 kB +0.34% +864 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.54 kB +0.34% +864 B 🔺
@sentry/nextjs (client) 47.48 kB +0.63% +294 B 🔺
@sentry/sveltekit (client) 43.18 kB +0.67% +286 B 🔺
@sentry/node-core 52.32 kB +0.17% +84 B 🔺
@sentry/node 174.99 kB +0.17% +282 B 🔺
@sentry/node - without tracing 97.47 kB +0.09% +81 B 🔺
@sentry/aws-serverless 113.27 kB +0.07% +76 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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,672 - 9,167 -5%
GET With Sentry 1,652 19% 1,740 -5%
GET With Sentry (error only) 5,990 69% 6,123 -2%
POST Baseline 1,190 - 1,196 -1%
POST With Sentry 568 48% 600 -5%
POST With Sentry (error only) 1,052 88% 1,068 -1%
MYSQL Baseline 3,215 - 3,344 -4%
MYSQL With Sentry 385 12% 510 -25%
MYSQL With Sentry (error only) 2,595 81% 2,729 -5%

View base workflow run

@JPeer264
Copy link
Member

JPeer264 commented Mar 9, 2026

@Lms24 is this ready to review? As this is a draft, but we are marked as reviewers

@Lms24 Lms24 marked this pull request as ready for review March 9, 2026 08:24
@Lms24
Copy link
Member Author

Lms24 commented Mar 9, 2026

@JPeer264 Yes, sorry, forgot to undraft after the last change

private _traceMap: Map<string, Set<SerializedStreamedSpanWithSegmentSpan>>;
private _traceWeightMap: Map<string, number>;
/* Bucket spans by their trace id, along with accumulated size and a per-trace flush timeout */
private _traceBuckets: Map<string, TraceBucket>;
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 take this PR as an opportunity to refactor the data structure of the buffer from multiple maps to one, holding all information as an object in one map

@Lms24 Lms24 requested a review from andreiborza March 9, 2026 08:26
@Lms24 Lms24 self-assigned this Mar 9, 2026
Copy link
Member

@JPeer264 JPeer264 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 b825c3d into lms/feat-span-first Mar 9, 2026
444 of 450 checks passed
@Lms24 Lms24 deleted the lms/fix-core-spanbuffer-flush-interval-by-trace branch March 9, 2026 13:43
Lms24 added a commit that referenced this pull request Mar 9, 2026
… flushing (#19686)

As discussed yesterday with @cleptric, we don't want a global
interval-based flushing but the interval shall be set per trace bucket.
This PR makes that change.
Lms24 added a commit that referenced this pull request Mar 10, 2026
… flushing (#19686)

As discussed yesterday with @cleptric, we don't want a global
interval-based flushing but the interval shall be set per trace bucket.
This PR makes that change.
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