-
Notifications
You must be signed in to change notification settings - Fork 948
Update Fireperf logging to use sendBeacon only if the payload is under the 64KB limit #9120
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
base: main
Are you sure you want to change the base?
Conversation
…r the 64KB limit for most browsers. - For the flush, attempt to use sendBeacon with a low number of events incase sendBeacon is also used by other libraries.
🦋 Changeset detectedLatest commit: 74db5f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Changeset File Check ✅
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
6f57725
to
74db5f8
Compare
@@ -88,7 +89,7 @@ describe('Firebase Performance > transport_service', () => { | |||
expect(fetchStub).to.not.have.been.called; | |||
}); | |||
|
|||
it('sends up to the maximum event limit in one request', async () => { | |||
it('sends up to the maximum event limit in one request if payload is under 64 KB', async () => { |
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.
How are we ensuring that the payload is less than 64KB in this test? Is this based on the size of the events?
}) | ||
); | ||
|
||
const payload = 'a'.repeat(300); |
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.
Just a nit pick. Is there a way we cna turn the payload to be a factor of may be 512B so that we dispatch 128+ events to achieve the 64KB+ situation? That way it would be easier to understad what is happening in the test. Currently, it is cryptic.
const MAX_SEND_BEACON_PAYLOAD_SIZE = 65536; | ||
// The max number of events to send during a flush. This number is kept low to since Chrome has a | ||
// shared payload limit for all sendBeacon calls in the same nav context. | ||
const MAX_FLUSH_SIZE = 40; |
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.
How did we arrive at this 40? Is this heuristic driven or are we making it as a random pick. If a random pick, should we make it Remote COnfig configurable with default value of 40?
Addresses issue #9067
From this comment,
Edge and Firefox enforce a 64KB limit per beacon. Chrome enforces a 64KB quota across all beacon-initiated requests within same nav context.
Since Chrome enforces a limit across all beacon requests, we'll attempt to use sendBeacon with a low number of events incase sendBeacon is also used by other libraries.