This repository has been archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
4 times, most recently
from
September 10, 2024 10:28
b0d1ef7
to
8dc3897
Compare
3 tasks
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
from
September 10, 2024 11:15
8dc3897
to
792270b
Compare
ankur22
commented
Sep 10, 2024
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
5 times, most recently
from
September 10, 2024 13:54
7186973
to
f9b4d51
Compare
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
2 times, most recently
from
September 10, 2024 16:00
b0d8b60
to
986f58a
Compare
@ankur22 Before reviewing, there's a data race on the test that this PR adds:
|
I believe this is resolved in a new PR i created here. I've ran a race test with this fix and it seems to have solved it. |
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
from
September 11, 2024 08:04
986f58a
to
11e5647
Compare
ankur22
commented
Sep 11, 2024
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
from
September 11, 2024 15:42
af38da9
to
d02e65c
Compare
inancgumus
approved these changes
Sep 11, 2024
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.
LGTM 👍 Nice fix!
This moves the navigation span starting into its own method since it will likely be needed elsewhere.
It looks like we weren't ending the span when a new navigation span was being started.
The navigation span was started a lot later than it should have. This meant that child spans (such as web vitals) looked incorrect since the values of those child spans were longer than the navigation span. Now the navigation span is started a lot earlier, and this means that the child span values are safely within the permitted navigation span. We still have a navigation span start from onFrameNavigated which is needed when the iteration starts on a new page, since onFrameStartedLoading isn't called when a new page is called and it navigates to about:blank.
When the navigation span is started, the new URL is not available to us yet. We have to defer the adding of the url attribute to the span to the end of the navigation span.
It was useful to have a test to ensure that the navigation spans were created in the expected order before and after the fix.
This is to help mimic expected test structure. The page.close should help determine when the test ends and whether there are any anomalies.
This also protects the retrieval of the url with the mutex.
Adding better ways of waiting for API to end with the use of waitUntil and waitForNavigation. Now comparing the elements within the slices and not worrying about the order since the order can change on every test run.
ankur22
force-pushed
the
fix/span-duration-web-vital
branch
from
September 12, 2024 13:52
0f96ee8
to
0907ad5
Compare
inancgumus
approved these changes
Sep 12, 2024
- Rename it to better represent what it is doing and the cost of the action. - Use clone instead of copy.
This isn't available in go <1.21 so reverting to copy for now.
inancgumus
approved these changes
Sep 12, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This fixes the navigation span so that the duration is longer than the duration of the child spans. This fix is to start the navigation span earlier in
onFrameStartedLoading
. It also required us to differ adding the url attribute to the navigation span to when it was ended since we don't have knowledge of the new url inonFrameStartedLoading
.Why?
This ensures that the child span values make sense with respect to the parent/navigation span they are part of.
Before the fix:
After the fix:
Checklist
Related PR(s)/Issue(s)
Updates: #1413