-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix navigation span start #1421
Conversation
b0d1ef7
to
8dc3897
Compare
8dc3897
to
792270b
Compare
7186973
to
f9b4d51
Compare
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. |
986f58a
to
11e5647
Compare
af38da9
to
d02e65c
Compare
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.
0f96ee8
to
0907ad5
Compare
- 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.
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