[DO NOT MERGE] Start sentry from native#82858
[DO NOT MERGE] Start sentry from native#82858elirangoshen wants to merge 24 commits intoExpensify:mainfrom
Conversation
|
|
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@elirangoshen can you get this cleaned up a bit before I re-review https://github.com/Expensify/Mobile-Expensify/pull/13855? It's still not clear to me how we're using the native app start time we added, and it looks like this PR contains both the TurboModule and the NitroModule implementations. |
- Delete AppStartTimeModule.kt (TurboModule) which was unused by JS - Remove its registration from ExpensifyAppPackage - Replace AppStartTimeModule.appStartTime assignment in MainApplication with direct SharedPreferences write (matching what the NitroModule reads) - Replace AppStartTime.setAppStartTime() in AppDelegate with direct UserDefaults write (matching what the NitroModule reads) - Update Mobile-Expensify submodule to eliran/native-module-start-time HEAD The NitroModule (HybridAppStartTimeModule) is the single implementation. Native startup writes the timestamp to SharedPreferences/UserDefaults, JS reads it via AppStartTimeNitroModule.appStartTime and uses it to backdate the SPAN_APP_STARTUP Sentry span to true native launch time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lication Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
done |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@abdulrahuman5196 @roryabraham One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
modules/ExpensifyNitroUtils/src/specs/AppStartTimeModule.nitro.ts
Outdated
Show resolved
Hide resolved
Code Review - Claude CodeCritical Issues1. Bug: The original 2. Bug: Sentry The native modules store Medium Issues3. Telemetry disabled on fallback platforms ( The default 4. The native entry points ( Minor Issues5.
6. Silent error swallowing ( The catch block silently swallows errors from 7. Unrelated Podfile.lock change
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38d9c0092c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Guard against 0 value from NitroModule (would backdate span to Unix epoch) - Use Log.warn instead of silent catch for NitroModule read failure - Add justification to eslint-disable comment in AppStartTimeModule spec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
- Restore breadcrumbsIntegration and consoleIntegration that were accidentally dropped in the setupSentry refactor - Add comment to recordAppStartTime() explaining it cannot be called from JS and that recording is done natively Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| class HybridAppStartTimeModule : HybridAppStartTimeModuleSpec() { | ||
| override val memorySize: Long = 16L |
There was a problem hiding this comment.
If we're tracking here is the Android MainApplication tracking redundant?
There was a problem hiding this comment.
No as the MainApplication tracking is for the standalone application and this tracking is for the HybridApp.
Do you think we should add the same early entry using ContentProvider to the standalone app as well ?
There was a problem hiding this comment.
Do you think we should add the same early entry
Yeah I guess that makes sense?
As for the standalone app tracking, I don't think we need that as users will remain on HybridApp for another year or so. However, if we could isolate the metrics within Sentry it would be fine.
There was a problem hiding this comment.
ok so I added tag to distinguish between those build types. let me know if its ok
| * initializes. The actual recording is done natively — in MainApplication.onCreate() | ||
| * on Android and AppDelegate.didFinishLaunchingWithOptions() on iOS — by writing |
There was a problem hiding this comment.
The actual recording is done natively — in MainApplication.onCreate()
Leaving this comment for now, to remember to verify this function comment
|
No product review needed |
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
Explanation of Change
Backdates the
SPAN_APP_STARTUPSentry performance span to the true native app launch time, rather than when JS initializes.Problem: The
SPAN_APP_STARTUPspan was previously starting when JS runs, which misses the native launch phase (JVM startup,Application.onCreate, RN bridge init, etc.) and underreports startup duration.Solution:
MainApplication.onCreate): writes to SharedPreferencesAppDelegate.didFinishLaunchingWithOptions): writes to UserDefaultsAppStartTimeModuleNitroModule (added toExpensifyNitroUtils)src/setup/telemetry/index.native.ts, readAppStartTimeNitroModule.appStartTimeand pass it asstartTimetostartSpan(SPAN_APP_STARTUP, ...)so Sentry records the span from true native launchThe companion Mobile-Expensify PR (for HybridApp builds, where a
ContentProviderrecords the time even earlier) is: https://github.com/Expensify/Mobile-Expensify/pull/13855Fixed Issues
$ #82974
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13855
Do not merge until https://github.com/Expensify/Mobile-Expensify/pull/13855 would be merged
Tests
SPAN_APP_STARTUPtransactionAppStartTimeModuleOffline tests
N/A — only affects Sentry telemetry, no offline behavior impact.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari