-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
clients(lr): gather network timing numbers from headers #7888
Conversation
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.
exciting stuff! :D
|
||
this.timing.connectStart = 0; | ||
this.timing.connectEnd = TCPTime; | ||
this.timing.sslStart = TCPTime - SSLTime; |
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.
should we check these assumptions too, not just total time?
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.
Hm, would we check that SSLTime !> TCPTime, thus making SSLStart negative? We can.
Co-Authored-By: exterkamp <shaneexterkamp5@gmail.com>
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
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.
one issue is that you won't have any particular debugging/logging signal if any of those bail points are hit, just that the lrStatistics
in the audit won't be set, right?
@@ -223,6 +242,7 @@ module.exports = class NetworkRequest { | |||
|
|||
this._updateResponseReceivedTimeIfNecessary(); | |||
this._updateTransferSizeForLightrider(); | |||
this._updateTimingsForLightrider(); |
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.
can we combine these two into one call (even if it then calls the two functions) so the control flow is clear. this._fixLightriderWithHeaders
or whatever
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.
what's the benefit of combining them here?
I actually like that it's explicitly calling out what will be touched and for what reason
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.
what's the benefit of combining them here?
they're always called together, so making them rooted in a single call means it's not possible to separate them accidentally, and to keep this isolated, a clear branching point where some of the numbers from earlier are replaced by values from the headers.
I think it's totally fine to keep them as separate functions (called from that single function) with descriptive names.
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 was also thinking we could add new method called _finalizeRequestDetails
(or _finalizeRequestDetailsOnLoadingComplete
) which onLoadingFailed
and onLoadingFinished
both call.
But i agree with keeping these two LR methods separate.
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 was also thinking we could add new method called
_finalizeRequestDetails
heaven forfend that we keep platform-specific workarounds grouped by platform, but this would at least be an improvement
Lets get more authors on this to confuse Googlebot. Co-Authored-By: exterkamp <shaneexterkamp5@gmail.com>
… out breaking changes. Skipped tests.
@@ -223,6 +242,7 @@ module.exports = class NetworkRequest { | |||
|
|||
this._updateResponseReceivedTimeIfNecessary(); | |||
this._updateTransferSizeForLightrider(); | |||
this._updateTimingsForLightrider(); |
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 was also thinking we could add new method called
_finalizeRequestDetails
heaven forfend that we keep platform-specific workarounds grouped by platform, but this would at least be an improvement
global.isLightrider = false; | ||
|
||
assert.equal(req.transferSize, 100); | ||
req._updateTransferSizeForLightrider(); |
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.
ideally we shouldn't be testing the internal implementation.
How do you feel about using network-records-to-devtools-log.js
? It already supports headers, so should be pretty easy to change this code over to using that. It would create the devtools log from a minimal example network record with X-*
response headers, run the log through NetworkRecorder.recordsFromLogs
, and then assert on the record that comes out.
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.
the change really should be pretty trivial. I can add it if you want, so we can get this in faster
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.
Yeah can you get that. I'm not 100% on what it entails.
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 think maybe the meat got removed because of the breaking changes comment? even without it, I think there are a few things to fix before landing, so IMO 4.3.0 should proceed without it
assert.equal(req.responseReceivedTime, 1); | ||
}); | ||
|
||
it('does nothing if timing is not initialized', function() { |
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.
seems like this test doesn't do anything since the headers aren't set?
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.
Right, it is confirming that the header timing isn't changed if no header is set. Like if we made a change that always messed this up and set the value no matter what the header said it would break this b/c we shouldn't be messing with the timing w/o a header.
global.isLightrider = false; | ||
|
||
assert.equal(req.transferSize, 100); | ||
req._updateTransferSizeForLightrider(); |
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.
the change really should be pretty trivial. I can add it if you want, so we can get this in faster
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.
my concerns are resolved
Co-Authored-By: exterkamp <shaneexterkamp5@gmail.com>
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.
my concerns are resolved too, excited for the followup that gives this teeth :)
* generate devtoolsLogs for tests * feedback
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.
⏱ 📈 📜
Summary
Add network request timing data from lightrider headers like FetchedSize. Add network-request tests.