@@ -45,7 +45,7 @@ import {
4545import { buildSearchQueryJSON , buildUserReadableQueryString , getQueryWithoutFilters , getUserFriendlyKey , getUserFriendlyValue , shouldHighlight } from '@libs/SearchQueryUtils' ;
4646import { getDatePresets , getHasOptions } from '@libs/SearchUIUtils' ;
4747import StringUtils from '@libs/StringUtils' ;
48- import { endSpan } from '@libs/telemetry/activeSpans' ;
48+ import { endSpan , getSpan , startSpan } from '@libs/telemetry/activeSpans' ;
4949import CONST , { CONTINUATION_DETECTION_SEARCH_FILTER_KEYS } from '@src/CONST' ;
5050import ONYXKEYS from '@src/ONYXKEYS' ;
5151import type { CardFeeds , CardList , PersonalDetailsList , Policy , Report } from '@src/types/onyx' ;
@@ -184,6 +184,16 @@ function SearchAutocompleteList({
184184 const expensifyIcons = useMemoizedLazyExpensifyIcons ( [ 'History' , 'MagnifyingGlass' ] ) ;
185185
186186 const { options, areOptionsInitialized} = useOptionsList ( ) ;
187+
188+ const computeSpanStarted = useRef ( false ) ;
189+ if ( ! computeSpanStarted . current && getSpan ( CONST . TELEMETRY . SPAN_OPEN_SEARCH_ROUTER ) ) {
190+ startSpan ( CONST . TELEMETRY . SPAN_SEARCH_ROUTER_COMPUTE_OPTIONS , {
191+ name : CONST . TELEMETRY . SPAN_SEARCH_ROUTER_COMPUTE_OPTIONS ,
192+ op : 'function' ,
193+ } ) ;
194+ computeSpanStarted . current = true ;
195+ }
196+
187197 const searchOptions = ( ( ) => {
188198 if ( ! areOptionsInitialized ) {
189199 return defaultListOptions ;
@@ -901,6 +911,14 @@ function SearchAutocompleteList({
901911 }
902912 } , [ autocompleteQueryValue , onHighlightFirstItem , normalizedReferenceText ] ) ;
903913
914+ if ( isInitialRender && computeSpanStarted . current ) {
915+ endSpan ( CONST . TELEMETRY . SPAN_SEARCH_ROUTER_COMPUTE_OPTIONS ) ;
916+ startSpan ( CONST . TELEMETRY . SPAN_SEARCH_ROUTER_LIST_RENDER , {
917+ name : CONST . TELEMETRY . SPAN_SEARCH_ROUTER_LIST_RENDER ,
918+ op : 'ui.render' ,
919+ } ) ;
920+ }
921+
904922 return (
905923 < SelectionListWithSections < AutocompleteListItem >
906924 showLoadingPlaceholder
@@ -922,6 +940,7 @@ function SearchAutocompleteList({
922940 disableKeyboardShortcuts = { ! shouldSubscribeToArrowKeyEvents }
923941 addBottomSafeAreaPadding
924942 onLayout = { ( ) => {
943+ endSpan ( CONST . TELEMETRY . SPAN_SEARCH_ROUTER_LIST_RENDER ) ;
925944 setPerformanceTimersEnd ( ) ;
926945 setIsInitialRender ( false ) ;
927946 innerListRef . current ?. updateExternalTextInputFocus ( textInputRef ?. current ?. isFocused ( ) ?? false ) ;
0 commit comments