diff --git a/Mobile-Expensify b/Mobile-Expensify index 399f776efb73b..ad7cbdcc99ec4 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit 399f776efb73ba733817d11376ee164cca73b053 +Subproject commit ad7cbdcc99ec46cf94f8c830e90136565a566484 diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 4b28e52513c55..03b445497b057 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -1707,6 +1707,7 @@ const CONST = { SPAN_OPEN_REPORT: 'ManualOpenReport', SPAN_APP_STARTUP: 'ManualAppStartup', SPAN_NAVIGATE_TO_REPORTS_TAB: 'ManualNavigateToReportsTab', + SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER: 'ManualNavigateToReportsTabRender', SPAN_ON_LAYOUT_SKELETON_REPORTS: 'ManualOnLayoutSkeletonReports', SPAN_NAVIGATE_TO_INBOX_TAB: 'ManualNavigateToInboxTab', SPAN_OD_ND_TRANSITION: 'ManualOdNdTransition', diff --git a/src/components/Navigation/NavigationTabBar/index.tsx b/src/components/Navigation/NavigationTabBar/index.tsx index 67fa08bd3848b..69c812013c063 100644 --- a/src/components/Navigation/NavigationTabBar/index.tsx +++ b/src/components/Navigation/NavigationTabBar/index.tsx @@ -172,7 +172,7 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin } clearSelectedText(); interceptAnonymousUser(() => { - startSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, { + const parentSpan = startSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, { name: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, op: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, }); @@ -180,6 +180,7 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin startSpan(CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS, { name: CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS, op: CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS, + parentSpan, }); const rootState = navigationRef.getRootState() as State; diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index e470eebe447a9..e115254b8824b 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -57,7 +57,7 @@ import { shouldShowEmptyState, shouldShowYear as shouldShowYearUtil, } from '@libs/SearchUIUtils'; -import {cancelSpan, endSpan, startSpan} from '@libs/telemetry/activeSpans'; +import {cancelSpan, endSpan, getSpan, startSpan} from '@libs/telemetry/activeSpans'; import {getOriginalTransactionWithSplitInfo, hasValidModifiedAmount, isOnHold, isTransactionPendingDelete} from '@libs/TransactionUtils'; import Navigation, {navigationRef} from '@navigation/Navigation'; import type {SearchFullscreenNavigatorParamList} from '@navigation/types'; @@ -941,9 +941,31 @@ function Search({ const onLayout = useCallback(() => { endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB); + endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER); handleSelectionListScroll(sortedData, searchListRef.current); }, [handleSelectionListScroll, sortedData]); + useEffect(() => { + if (shouldShowLoadingState) { + return; + } + + const renderSpanParent = getSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB); + + if (renderSpanParent) { + startSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER, { + name: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER, + op: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER, + parentSpan: renderSpanParent, + }).setAttributes({ + inputQuery: queryJSON?.inputQuery, + }); + } + + // Exclude `queryJSON?.inputQuery` since it’s only telemetry metadata and would cause the span to start multiple times. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [shouldShowLoadingState]); + const onLayoutSkeleton = useCallback(() => { endSpan(CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS); }, []);