Skip to content
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

Allow negative performance timings #330

Merged
merged 6 commits into from
Feb 9, 2021

Conversation

mhennoch
Copy link
Contributor

@mhennoch mhennoch commented Feb 1, 2021

Which problem is this PR solving?

  • As mentioned in 1769 PerformanceNavigationTiming.fetchStart can be negative by a tiny amount ( seen values -1,-2, -3 during automated testing). Currently these entries get filtered out and no spans are created. We would like to see these spans and decide what to do with them in the backend.

Short description of the changes

  • Remove value >= 0 checks from both entry sources (PerformanceNavigationTiming and legacy perf.timing ). If they are negative then nothing should break:
    • If PerformanceNavigationTiming.fetchStart is -1 then when being converted to hrTime it will just be perf.timeOrigin - 1 which is close to the correct timestamp.
    • Same with legacy timings, although I've never seen them being negative usually just out of order (We've seen responseEnd before fetchStart for example : ) ) or 0.
  • Add and refactor tests. Replace Object.defineProperty usage with stubs(patch perf.timing getter) so that test order is not important anymore.

@mhennoch mhennoch requested a review from a team February 1, 2021 13:03
@mhennoch mhennoch changed the title Normalize timings Allow negative performance timings Feb 1, 2021
@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #330 (d987ff0) into main (dbbf02f) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #330   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files          12       12           
  Lines         409      409           
  Branches       45       45           
=======================================
  Hits          384      384           
  Misses         25       25           

Copy link
Member

@johnbley johnbley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dyladan dyladan added the enhancement New feature or request label Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants