Skip to content

ref(replay): Try to make flush on unload fully sync #6859

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

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 19, 2023

This PR adjusts #6854 to be fully sync.

I tried it in a test app, and it seemed to send the request out - I tried setting up a proxy to properly see logs, and it appeared correct, although not 100% sure if that matches real-world usage.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.82 KB (+0.01% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 61.47 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.5 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.77 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.22 KB (+0.05% 🔺)
@sentry/browser - Webpack (minified) 66.17 KB (-0.01% 🔽)
@sentry/react - Webpack (gzipped + minified) 20.24 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.51 KB (+0.07% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.73 KB (-0.05% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.02 KB (-0.02% 🔽)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.3 KB (-0.75% 🔽)
@sentry/replay - Webpack (gzipped + minified) 38.65 KB (+0.59% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.52 KB (-0.6% 🔽)

@mydea mydea force-pushed the fn/replay-send-sync branch from b14d60f to 6dfb6e2 Compare January 19, 2023 12:09
@mydea
Copy link
Member Author

mydea commented Jan 19, 2023

@billyvg feel free to merge this yourself if this appears good to you!

@billyvg
Copy link
Member

billyvg commented Jan 23, 2023

The network request still gets cancelled, although I don't think the transport is using keepalive -- how would I confirm if it's using it or not?

@Lms24
Copy link
Member

Lms24 commented Jan 23, 2023

I don't think the transport is using keepalive

It should be using fetch's keepalive flag:
https://github.com/getsentry/sentry-javascript/blob/223a20f3063bf8d501546132fdd2dca56c69c3d6/packages/browser/src/transports/fetch.ts#L31

@Lms24
Copy link
Member

Lms24 commented Jan 23, 2023

how would I confirm if it's using it or not

My best guess would be to start some requests that'd take a long time and perform a page navigation. This shouldn't cancel the requests.

@billyvg
Copy link
Member

billyvg commented Jan 23, 2023

OK I added some logpoints to confirm when keepalive is true and it seems to work, although still getting some missing segments.

mydea added a commit that referenced this pull request Jan 23, 2023
This ties into the changes from here: #6859
@mydea
Copy link
Member Author

mydea commented Jan 23, 2023

Ahhh, the problem is actually this: #6910

We just didn't even call the sync flush when unloading the page 😅 I was kind of under the impression we had this, but I guess not!

@billyvg billyvg merged commit 6022997 into feat-replay-flush-uncompressed-on-blur Jan 24, 2023
@billyvg billyvg deleted the fn/replay-send-sync branch January 24, 2023 15:28
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