Skip to content

ref(core): Remove redundant log buffer flush#22278

Merged
Lms24 merged 1 commit into
developfrom
ref/remove-redundant-log-flush
Jul 15, 2026
Merged

ref(core): Remove redundant log buffer flush#22278
Lms24 merged 1 commit into
developfrom
ref/remove-redundant-log-flush

Conversation

@Lms24

@Lms24 Lms24 commented Jul 15, 2026

Copy link
Copy Markdown
Member

This PR removes the explicit log-buffer flush from Client.close(). Client.flush() (called by close) already emits the flush hook, which we listen to in setupWeightBasedFlushing for logs and metrics. So the explicit call flushes enabled log buffers twice.

ref #19347

(just found this while going over our closing logic, so figured I'd remove the line)

Rely on Client.flush() to emit the flush hook and drain the enabled log buffer
once when the client closes.

Co-Authored-By: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.65 kB -0.02% -4 B 🔽
@sentry/browser - with treeshaking flags 26.09 kB -0.03% -7 B 🔽
@sentry/browser (incl. Tracing) 46.41 kB -0.02% -5 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 48.2 kB -0.02% -5 B 🔽
@sentry/browser (incl. Tracing, Profiling) 51.19 kB -0.01% -5 B 🔽
@sentry/browser (incl. Tracing, Replay) 85.67 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.3 kB -0.02% -9 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 90.38 kB -0.01% -5 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 103.04 kB -0.01% -4 B 🔽
@sentry/browser (incl. Feedback) 44.83 kB -0.02% -6 B 🔽
@sentry/browser (incl. sendFeedback) 32.45 kB -0.02% -5 B 🔽
@sentry/browser (incl. FeedbackAsync) 37.57 kB -0.02% -5 B 🔽
@sentry/browser (incl. Metrics) 28.73 kB -0.05% -13 B 🔽
@sentry/browser (incl. Logs) 28.97 kB -0.03% -6 B 🔽
@sentry/browser (incl. Metrics & Logs) 29.66 kB -0.03% -7 B 🔽
@sentry/react 29.45 kB -0.02% -5 B 🔽
@sentry/react (incl. Tracing) 48.67 kB -0.02% -5 B 🔽
@sentry/vue 33.08 kB -0.02% -6 B 🔽
@sentry/vue (incl. Tracing) 48.39 kB -0.02% -7 B 🔽
@sentry/svelte 27.67 kB -0.02% -5 B 🔽
CDN Bundle 30.05 kB -0.02% -6 B 🔽
CDN Bundle (incl. Tracing) 48.4 kB -0.02% -6 B 🔽
CDN Bundle (incl. Logs, Metrics) 31.63 kB -0.03% -7 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 49.7 kB -0.01% -4 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 70.86 kB -0.01% -7 B 🔽
CDN Bundle (incl. Tracing, Replay) 85.89 kB -0.01% -5 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.21 kB -0.01% -5 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 91.69 kB -0.01% -5 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.96 kB -0.01% -6 B 🔽
CDN Bundle - uncompressed 89.58 kB -0.02% -9 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 146.32 kB -0.01% -9 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.28 kB -0.01% -9 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.3 kB -0.01% -9 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.01 kB -0.01% -9 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.53 kB -0.01% -9 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.49 kB -0.01% -9 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.23 kB -0.01% -9 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.18 kB -0.01% -9 B 🔽
@sentry/nextjs (client) 51.22 kB -0.01% -5 B 🔽
@sentry/sveltekit (client) 46.86 kB -0.02% -7 B 🔽
@sentry/core/server 78.5 kB -0.01% -3 B 🔽
@sentry/core/browser 64.85 kB -0.01% -3 B 🔽
@sentry/node-core 62.79 kB -0.01% -4 B 🔽
@sentry/node 125.2 kB -0.01% -2 B 🔽
@sentry/node (incl. diagnostics channel injection) 140.23 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.96 kB - -
@sentry/node/light 50.79 kB -0.01% -3 B 🔽
@sentry/node - without tracing 74.17 kB -0.01% -6 B 🔽
@sentry/aws-serverless 83.38 kB -0.01% -8 B 🔽
@sentry/cloudflare (withSentry) - minified 181.78 kB -0.01% -9 B 🔽
@sentry/cloudflare (withSentry) 449.94 kB -0.01% -37 B 🔽

View base workflow run

@Lms24
Lms24 marked this pull request as ready for review July 15, 2026 09:06
@Lms24 Lms24 self-assigned this Jul 15, 2026
@Lms24
Lms24 requested a review from chargome July 15, 2026 09:12
.mockImplementation(() => undefined);

const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN });
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, enableLogs: true });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this related?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, the client guards the setupWeightBasedFlushing with enableLogs (something I imagine we wanna change for v11). So the test before called the flush function even if logs were disabled.

@Lms24
Lms24 merged commit 182aa34 into develop Jul 15, 2026
608 of 610 checks passed
@Lms24
Lms24 deleted the ref/remove-redundant-log-flush branch July 15, 2026 11:16
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