fix: use consistent clock for span durations - #98271
Closed
chrispader wants to merge 7 commits into
Closed
Conversation
Contributor
|
|
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Contributor
Author
|
Closing as a duplicate of #98152, which already contains the same clock-domain correction and regression coverage. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation of Change
This draft follow-up depends on #98144.
Native startup spans can receive an epoch-based start time from the native app-start module. The benchmark logger previously stored that epoch timestamp directly and later subtracted it from process-relative
performance.now(), producing durations around-1.785e12ms.This change converts Sentry's accepted start-time representation to epoch milliseconds once, translates it into the current process's monotonic clock domain, and then calculates elapsed time entirely with
performance.now(). It also keeps the diagnostic log timestamp in epoch milliseconds viaDate.now().A regression test covers an epoch-based startup span and verifies that a 750ms elapsed interval is logged as 750ms.
Fixed Issues
$
PROPOSAL:
Tests
Physical-device verification after rebuilding the release app is still pending, so this PR remains a draft.
.env:Mobile-Expensify.nr benchmark-app-startup ios 20 30 --span ManualAppStartup --device "Developer's iPhone" --app-id com.expensify.expensifylite-1.785e12ms.nr test --runInBand --watchman=false tests/unit/ActiveSpansBenchmarkTest.tsand verify the epoch-based duration regression test passes.Offline tests
Offline testing was not performed. The change only corrects local elapsed-time calculation and does not change network behavior.
QA Steps
This opt-in tooling is not enabled in standard staging builds. QA can validate it using the local release-build steps in
### Tests.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
No screenshots or videos are included because this change only corrects developer benchmark timing and does not modify the app UI.