From ad044a2b74e36c4836a5257cdc237e17d2462ec1 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Mon, 18 Nov 2024 00:48:28 +0100 Subject: [PATCH] feat: bring back firebase tracking for sidebar_loaded --- contributingGuides/PERFORMANCE_METRICS.md | 2 +- src/libs/actions/App.ts | 1 + src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index ecebbaae4e0e..9e942f21d918 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -14,7 +14,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `js_loaded` | ✅ | The time it takes for the JavaScript bundle to load.

**Platforms:** Android, iOS | **Android:** Starts in the `onCreate` method.

**iOS:** Starts in the AppDelegate's `didFinishLaunchingWithOptions` method. | Stops at the first render of the app via native module on the JS side. | | `_app_in_foreground` | ✅ | The time when the app is running in the foreground and available to the user.

**Platforms:** Android, iOS | **Android:** Starts when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Starts when the application receives the `UIApplicationDidBecomeActiveNotification` notification. | **Android:** Stops when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Stops when it receives the `UIApplicationWillResignActiveNotification` notification. | | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | -| `sidebar_loaded` | ❌ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the LHN finishes laying out. | +| `sidebar_loaded` | ✅ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the LHN finishes laying out. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | | `open_search` | ✅ | Time taken to open up the Search Router.

**Platforms:** All | Starts when the Search Router icon in LHN is pressed. | Stops when the list of available options finishes laying out. | | `load_search_options` | ✅ | Time taken to generate the list of options used in the Search Router.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index f778405ee6e8..f1f46aee0a93 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -180,6 +180,7 @@ function setSidebarLoaded() { Onyx.set(ONYXKEYS.IS_SIDEBAR_LOADED, true); Performance.markEnd(CONST.TIMING.SIDEBAR_LOADED); + Timing.end(CONST.TIMING.SIDEBAR_LOADED); } let appState: AppStateStatus; diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index 057189ae22c1..0dcb1124ee3e 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -12,6 +12,7 @@ import TopBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator import Navigation from '@libs/Navigation/Navigation'; import Performance from '@libs/Performance'; import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData'; +import Timing from '@userActions/Timing'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -24,6 +25,7 @@ function BaseSidebarScreen() { useEffect(() => { Performance.markStart(CONST.TIMING.SIDEBAR_LOADED); + Timing.start(CONST.TIMING.SIDEBAR_LOADED); }, []); useEffect(() => {