Repository navigation
[No QA] Add flash, capture method and time since app start to the shutter-to-confirmation span #104829
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
Open
OlimpiaZurek
wants to merge
8
commits into
Expensify:main
Choose a base branch
from
callstack-internal:feat/scan-shutter-span-attributes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+150
−5
Open
[No QA] Add flash, capture method and time since app start to the shutter-to-confirmation span #104829
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9fb27ee
[No QA] Add flash, capture method and time since app start to the shu…
OlimpiaZurek 38110b8
Merge branch 'main' into feat/scan-shutter-span-attributes
OlimpiaZurek 93a8afa
fix:Measure time since native app start on the monotonic clock
OlimpiaZurek 67c73b1
fix:Count device sleep in time since native app start
OlimpiaZurek 8130959
Merge branch 'main' into feat/scan-shutter-span-attributes
OlimpiaZurek ecd7d51
Merge branch 'main' into feat/scan-shutter-span-attributes
OlimpiaZurek 550b490
Add time since JS startup
OlimpiaZurek 8620a78
Merge branch 'main' into feat/scan-shutter-span-attributes
OlimpiaZurek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Elapsed time takes the larger of the Date.now() and performance.now() deltas: Date.now() goes backwards when the | ||
| // device clock is corrected, and performance.now() stops during Android deep sleep. JS cannot tell a forward clock | ||
| // correction from sleep, so a forward correction after setup inflates the value. | ||
| let appStartAgeAtSetupMs: number | undefined; | ||
| let dateNowAtSetupMs: number | undefined; | ||
| let performanceNowAtSetupMs = 0; | ||
|
|
||
| function setNativeAppStartTime(timestampMs: number | undefined) { | ||
| dateNowAtSetupMs = Date.now(); | ||
| performanceNowAtSetupMs = performance.now(); | ||
| appStartAgeAtSetupMs = timestampMs === undefined ? undefined : dateNowAtSetupMs - timestampMs; | ||
| } | ||
|
|
||
| function getElapsedMsSinceSetup(): number | undefined { | ||
| if (dateNowAtSetupMs === undefined) { | ||
| return undefined; | ||
| } | ||
| return Math.max(Date.now() - dateNowAtSetupMs, performance.now() - performanceNowAtSetupMs); | ||
| } | ||
|
|
||
| function getMsSinceJsStartup(): number | undefined { | ||
| const elapsedMs = getElapsedMsSinceSetup(); | ||
| return elapsedMs === undefined ? undefined : Math.round(elapsedMs); | ||
| } | ||
|
|
||
| function getMsSinceNativeAppStart(): number | undefined { | ||
| const elapsedMs = getElapsedMsSinceSetup(); | ||
| if (appStartAgeAtSetupMs === undefined || elapsedMs === undefined) { | ||
| return undefined; | ||
| } | ||
| return Math.round(appStartAgeAtSetupMs + elapsedMs); | ||
| } | ||
|
|
||
| export {getMsSinceJsStartup, getMsSinceNativeAppStart, setNativeAppStartTime}; |
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
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
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
Oops, something went wrong.
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.
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.
duration_since_native_app_startup_msreuses the 60s prewarm guard from the startup span. So the value is missing for every session where RN boots more than 60s after the native process starts, not only prewarmed iOS processes.In HybridApp that happens a lot. RN setup only starts after OldDot hands off (
OldDotToRNHandoff), so these sessions get no value:In those sessions the native process is old but JS/RN is cold. That's the case most likely to look like "slow right after launch". Dropping them, and lumping them in with NitroModule read failures, skews the p95-by-startup-age split this PR is meant to enable.
Suggestion: always record the setup clocks, and also report time since JS setup. Then set a second attribute (e.g.
duration_since_js_start_ms) onManualShutterToConfirmationnext to the native one. With both, process old + RN cold can be told apart from "true cold" launch