From 3db3d99fe6ccd5c19284431d226f9ecbb13cb0df Mon Sep 17 00:00:00 2001 From: Abdkhan14 <60121741+Abdkhan14@users.noreply.github.com> Date: Thu, 17 Aug 2023 10:14:00 -0400 Subject: [PATCH] feat(tracing-w/o-performance): Handling split results form events-trace-light endpoint (#54937) This frontend PR aims to handle the split `{"transactions": [...], "orphan_errors": [...]}` response from the `events-trace-light` endpoint under the feature flag `organizations:performance-tracing-without-performance`. The trace navigator should load with out any errors for orphan errors in issues details and discover details. Link to test with yarn dev-ui:[ link](https://sentry.dev.getsentry.net:7999/issues/4389114778/?query=is%3Aunresolved&referrer=issue-stream&stream_index=1) Context: We are now adding views for orphan errors in trace views. Part of [Tracing without performance concept.](https://www.notion.so/sentry/Tracing-without-performance-efab307eb7f64e71a04f09dc72722530) Performance Views for tracing without performance: [link](https://getsentry.atlassian.net/browse/PERF-2052) --------- Co-authored-by: Abdullah Khan --- .../performance/quickTrace/quickTraceQuery.tsx | 17 ++++++++++++++++- .../performance/quickTrace/traceLiteQuery.tsx | 4 +++- .../app/utils/performance/quickTrace/types.tsx | 2 +- .../views/performance/traceDetails/utils.tsx | 3 ++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/static/app/utils/performance/quickTrace/quickTraceQuery.tsx b/static/app/utils/performance/quickTrace/quickTraceQuery.tsx index f5f1aa427442d..2a731ab8a8b08 100644 --- a/static/app/utils/performance/quickTrace/quickTraceQuery.tsx +++ b/static/app/utils/performance/quickTrace/quickTraceQuery.tsx @@ -5,8 +5,10 @@ import {DiscoverQueryProps} from 'sentry/utils/discover/genericDiscoverQuery'; import {TraceFullQuery} from 'sentry/utils/performance/quickTrace/traceFullQuery'; import TraceLiteQuery from 'sentry/utils/performance/quickTrace/traceLiteQuery'; import { + EventLite, QuickTraceQueryChildrenProps, TraceFull, + TraceLite, TraceSplitResults, } from 'sentry/utils/performance/quickTrace/types'; import { @@ -108,9 +110,22 @@ export default function QuickTraceQuery({children, event, ...props}: QueryProps) traceLiteResults.trace !== null ) { const {trace} = traceLiteResults; + const {transactions: transactionLite, orphanErrors: orphanErrorsLite} = + getTraceSplitResults(trace ?? [], organization); + + const orphanError = + orphanErrorsLite && orphanErrorsLite.length === 1 + ? orphanErrorsLite[0] + : undefined; + const traceTransactions = transactionLite ?? (trace as TraceLite); return children({ ...traceLiteResults, - currentEvent: trace.find(e => isCurrentEvent(e, event)) ?? null, + trace: traceTransactions, + orphanErrors: orphanErrorsLite, + currentEvent: + orphanError ?? + traceTransactions.find(e => isCurrentEvent(e, event)) ?? + null, }); } diff --git a/static/app/utils/performance/quickTrace/traceLiteQuery.tsx b/static/app/utils/performance/quickTrace/traceLiteQuery.tsx index cb807cde0038a..9c7794af7c8df 100644 --- a/static/app/utils/performance/quickTrace/traceLiteQuery.tsx +++ b/static/app/utils/performance/quickTrace/traceLiteQuery.tsx @@ -5,9 +5,11 @@ import GenericDiscoverQuery, { } from 'sentry/utils/discover/genericDiscoverQuery'; import { BaseTraceChildrenProps, + EventLite, PartialQuickTrace, TraceLite, TraceRequestProps, + TraceSplitResults, } from 'sentry/utils/performance/quickTrace/types'; import { getTraceRequestPayload, @@ -20,7 +22,7 @@ type AdditionalQueryProps = { type TraceLiteQueryChildrenProps = BaseTraceChildrenProps & Omit & { - trace: TraceLite | null; + trace: TraceLite | TraceSplitResults | null; }; type QueryProps = Omit & diff --git a/static/app/utils/performance/quickTrace/types.tsx b/static/app/utils/performance/quickTrace/types.tsx index 6bde05a03328a..0a76f65be1615 100644 --- a/static/app/utils/performance/quickTrace/types.tsx +++ b/static/app/utils/performance/quickTrace/types.tsx @@ -83,7 +83,7 @@ export type TraceFullDetailed = Omit & { tags?: EventTag[]; }; -export type TraceSplitResults = { +export type TraceSplitResults = { orphan_errors: TraceError[]; transactions: U[]; }; diff --git a/static/app/views/performance/traceDetails/utils.tsx b/static/app/views/performance/traceDetails/utils.tsx index c838f942df7c7..a694065b4c2ef 100644 --- a/static/app/views/performance/traceDetails/utils.tsx +++ b/static/app/views/performance/traceDetails/utils.tsx @@ -3,6 +3,7 @@ import {LocationDescriptor, Query} from 'history'; import {PAGE_URL_PARAM} from 'sentry/constants/pageFilters'; import {Organization, OrganizationSummary} from 'sentry/types'; import { + EventLite, TraceError, TraceFull, TraceFullDetailed, @@ -63,7 +64,7 @@ export function hasTraceData( ); } -export function getTraceSplitResults( +export function getTraceSplitResults( trace: TraceSplitResults | U[], organization: Organization ) {