@@ -10,7 +10,7 @@ import {
1010 SourceKind ,
1111 TSource ,
1212} from '@hyperdx/common-utils/dist/types' ;
13- import { Anchor , Box , Divider , Group , Text } from '@mantine/core' ;
13+ import { Anchor , Box , Code , Divider , Group , Text } from '@mantine/core' ;
1414
1515import { ContactSupportText } from '@/components/ContactSupportText' ;
1616import useOffsetPaginatedQuery from '@/hooks/useOffsetPaginatedQuery' ;
@@ -245,28 +245,37 @@ export function useEventsAroundFocus({
245245 /** A lucene expression that identifies rows to be hidden. Hidden rows will be returned with a `__hdx_hidden: true` column. */
246246 hiddenRowExpression ?: string ;
247247} ) {
248- let isFetching = false ;
249248 const { config, alias, type } = useMemo (
250249 ( ) => getConfig ( tableSource , traceId , hiddenRowExpression ) ,
251250 [ tableSource , traceId , hiddenRowExpression ] ,
252251 ) ;
253252
254- const { data : beforeSpanData , isFetching : isBeforeSpanFetching } =
255- useEventsData ( {
256- config,
257- dateRangeStartInclusive : true ,
258- dateRange : [ dateRange [ 0 ] , focusDate ] ,
259- enabled,
260- } ) ;
261- const { data : afterSpanData , isFetching : isAfterSpanFetching } =
262- useEventsData ( {
263- config,
264- dateRangeStartInclusive : false ,
265- dateRange : [ focusDate , dateRange [ 1 ] ] ,
266- enabled,
267- } ) ;
268- isFetching = isFetching || isBeforeSpanFetching || isAfterSpanFetching ;
253+ const {
254+ data : beforeSpanData ,
255+ isFetching : isBeforeSpanFetching ,
256+ error : beforeSpanError ,
257+ } = useEventsData ( {
258+ config,
259+ dateRangeStartInclusive : true ,
260+ dateRange : [ dateRange [ 0 ] , focusDate ] ,
261+ enabled,
262+ } ) ;
263+
264+ const {
265+ data : afterSpanData ,
266+ isFetching : isAfterSpanFetching ,
267+ error : afterSpanError ,
268+ } = useEventsData ( {
269+ config,
270+ dateRangeStartInclusive : false ,
271+ dateRange : [ focusDate , dateRange [ 1 ] ] ,
272+ enabled,
273+ } ) ;
274+
275+ const isFetching = isBeforeSpanFetching || isAfterSpanFetching ;
269276 const meta = beforeSpanData ?. meta ?? afterSpanData ?. meta ;
277+ const error = beforeSpanError || afterSpanError ;
278+
270279 const rowWhere = useRowWhere ( { meta, aliasMap : alias } ) ;
271280 const rows = useMemo ( ( ) => {
272281 // Sometimes meta has not loaded yet
@@ -294,6 +303,7 @@ export function useEventsAroundFocus({
294303 rows,
295304 meta,
296305 isFetching,
306+ error,
297307 } ;
298308}
299309
@@ -352,6 +362,7 @@ export function DBTraceWaterfallChartContainer({
352362 rows : traceRowsData ,
353363 isFetching : traceIsFetching ,
354364 meta : traceRowsMeta ,
365+ error : traceError ,
355366 } = useEventsAroundFocus ( {
356367 tableSource : traceTableSource ,
357368 focusDate,
@@ -364,6 +375,7 @@ export function DBTraceWaterfallChartContainer({
364375 rows : logRowsData ,
365376 isFetching : logIsFetching ,
366377 meta : logRowsMeta ,
378+ error : logError ,
367379 } = useEventsAroundFocus ( {
368380 // search data if logTableModel exist
369381 // search invalid date range if no logTableModel(react hook need execute no matter what)
@@ -376,6 +388,8 @@ export function DBTraceWaterfallChartContainer({
376388 } ) ;
377389
378390 const isFetching = traceIsFetching || logIsFetching ;
391+ const error = traceError || logError ;
392+
379393 const rows : any [ ] = useMemo (
380394 ( ) => [ ...traceRowsData , ...logRowsData ] ,
381395 [ traceRowsData , logRowsData ] ,
@@ -799,6 +813,9 @@ export function DBTraceWaterfallChartContainer({
799813 ) }
800814 </ span >
801815 </ Group >
816+ { ! isFetching && ! error && (
817+ < DBHighlightedAttributesList attributes = { highlightedAttributeValues } />
818+ ) }
802819 < div
803820 style = { {
804821 position : 'relative' ,
@@ -808,6 +825,20 @@ export function DBTraceWaterfallChartContainer({
808825 >
809826 { isFetching ? (
810827 < div className = "my-3" > Loading Traces...</ div >
828+ ) : error ? (
829+ < Box mt = "lg" >
830+ < Text my = "sm" size = "sm" >
831+ An error occurred while fetching trace data:
832+ </ Text >
833+ < Code
834+ block
835+ style = { {
836+ whiteSpace : 'pre-wrap' ,
837+ } }
838+ >
839+ { error . message }
840+ </ Code >
841+ </ Box >
811842 ) : rows == null ? (
812843 < div >
813844 An unknown error occurred. < ContactSupportText />
@@ -816,9 +847,6 @@ export function DBTraceWaterfallChartContainer({
816847 < div className = "my-3" > No matching spans or logs found</ div >
817848 ) : (
818849 < >
819- < DBHighlightedAttributesList
820- attributes = { highlightedAttributeValues }
821- />
822850 < TimelineChart
823851 style = { {
824852 overflowY : 'auto' ,
0 commit comments