-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(replay): Allow to treeshake & configure compression worker URL #9409
Conversation
expect(replayEvent0).toEqual(getExpectedReplayEvent()); | ||
|
||
const snapshots = getFullRecordingSnapshots(await reqPromise0); | ||
expect(replayEnvelopeIsCompressed(req0)).toEqual(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added a check to actually test that we are sending a compressed payload 😅
62dccc4
to
61feab0
Compare
size-limit report 📦
|
Follow up: In e.g. next.js, we could do this automatically, which would reduce bundle size etc. |
Co-authored-by: Billy Vong <billyvg@users.noreply.github.com>
de39290
to
f5afdb0
Compare
@@ -0,0 +1,2 @@ | |||
/*! Sentry Replay Worker 7.76.0 (de39290bc) | https://github.com/getsentry/sentry-javascript */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a banner here with the version etc. for clarity!
This PR does two things:
workerUrl
in replay config, which is expected to be an URL of a self-hosted worker script.a. Added an example worker script, which is a built version of the pako-based compression worker
a. Users can basically host this file themselves and point to it in
workerUrl
, as long as it is on the same origin as the website itself.a. We can eventually document this in docs
__SENTRY_EXCLUDE_REPLAY_WORKER__
in your build to strip the default included web worker. You can configure this if you're disabling compression anyhow, or if you want to configure a custom web worker as in the above step.Fixes #6739, and allows to reduce bundle size further. Once merged/released we can also add this to the bundler plugins
bundleSizeOptimizations
options.Note that we do not recommend to disable the web worker completely. We only recommend to tree shake the worker code if you provide a custom worker URL - else, replay payloads will not be compressed, resulting in much larger payloads sent over the network, which is bad for your applications performance.
Also note that when providing a custom worker, it is your own responsibility to keep it up to date - we try to keep the worker interface stable, and the worker is generally not updated often, but you should still check regularly when updating the SDK if the example worker has changed.