Skip to content

Commit

Permalink
feat(tracing-w/o-performance): Handling split results form events-tra…
Browse files Browse the repository at this point in the history
…ce-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 <abdullahkhan@PG9Y57YDXQ.local>
  • Loading branch information
Abdkhan14 and Abdullah Khan committed Aug 17, 2023
1 parent 5e70962 commit 3db3d99
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
17 changes: 16 additions & 1 deletion static/app/utils/performance/quickTrace/quickTraceQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -108,9 +110,22 @@ export default function QuickTraceQuery({children, event, ...props}: QueryProps)
traceLiteResults.trace !== null
) {
const {trace} = traceLiteResults;
const {transactions: transactionLite, orphanErrors: orphanErrorsLite} =
getTraceSplitResults<EventLite>(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,
});
}

Expand Down
4 changes: 3 additions & 1 deletion static/app/utils/performance/quickTrace/traceLiteQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -20,7 +22,7 @@ type AdditionalQueryProps = {

type TraceLiteQueryChildrenProps = BaseTraceChildrenProps &
Omit<PartialQuickTrace, 'trace'> & {
trace: TraceLite | null;
trace: TraceLite | TraceSplitResults<EventLite> | null;
};

type QueryProps = Omit<TraceRequestProps, 'eventView'> &
Expand Down
2 changes: 1 addition & 1 deletion static/app/utils/performance/quickTrace/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type TraceFullDetailed = Omit<TraceFull, 'children'> & {
tags?: EventTag[];
};

export type TraceSplitResults<U extends TraceFull | TraceFullDetailed> = {
export type TraceSplitResults<U extends TraceFull | TraceFullDetailed | EventLite> = {
orphan_errors: TraceError[];
transactions: U[];
};
Expand Down
3 changes: 2 additions & 1 deletion static/app/views/performance/traceDetails/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,7 +64,7 @@ export function hasTraceData(
);
}

export function getTraceSplitResults<U extends TraceFullDetailed | TraceFull>(
export function getTraceSplitResults<U extends TraceFullDetailed | TraceFull | EventLite>(
trace: TraceSplitResults<U> | U[],
organization: Organization
) {
Expand Down

0 comments on commit 3db3d99

Please sign in to comment.