Skip to content

Commit

Permalink
ref(trace) split trace node class
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Sep 28, 2024
1 parent 628aab7 commit 356f41d
Show file tree
Hide file tree
Showing 75 changed files with 1,346 additions and 1,364 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {EventTransaction} from 'sentry/types/event';
import type {Organization} from 'sentry/types/organization';
import getDuration from 'sentry/utils/duration/getDuration';
import toPercent from 'sentry/utils/number/toPercent';
import {TraceType} from 'sentry/views/performance/traceDetails/newTraceDetailsContent';
import {TraceShape} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import type {TraceInfo} from 'sentry/views/performance/traceDetails/types';

import * as DividerHandlerManager from './dividerHandlerManager';
Expand All @@ -19,7 +19,7 @@ type PropType = {
event: EventTransaction | undefined;
organization: Organization;
traceInfo: TraceInfo;
traceType: TraceType;
traceType: TraceShape;
traceViewHeaderRef: React.RefObject<HTMLDivElement>;
};

Expand Down Expand Up @@ -84,7 +84,7 @@ function TraceViewHeader(props: PropType) {

const opsBreakdown = generateStats(event, {type: 'no_filter'});
const httpOp = opsBreakdown.find(obj => obj.name === 'http.client');
const hasServiceBreakdown = httpOp && props.traceType === TraceType.ONE_ROOT;
const hasServiceBreakdown = httpOp && props.traceType === TraceShape.ONE_ROOT;

return (
<HeaderContainer ref={props.traceViewHeaderRef} hasProfileMeasurementsChart={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ import {FrameContainer} from 'sentry/views/insights/database/components/stackTra
import {ModuleName} from 'sentry/views/insights/types';
import {IssueList} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/issues/issues';
import {TraceDrawerComponents} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/styles';
import type {
TraceTree,
TraceTreeNode,
} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import type {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import type {TraceTreeNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode';
import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';
import {GeneralSpanDetailsValue} from 'sentry/views/performance/traceDetails/newTraceDetailsValueRenderer';
import {spanDetailsRouteWithQuery} from 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails/utils';
Expand Down
75 changes: 37 additions & 38 deletions static/app/views/performance/newTraceDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,70 +44,69 @@ import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import {useParams} from 'sentry/utils/useParams';
import useProjects from 'sentry/utils/useProjects';
import {traceAnalytics} from 'sentry/views/performance/newTraceDetails/traceAnalytics';
import type {ReplayTrace} from 'sentry/views/replays/detail/trace/useReplayTraces';
import type {ReplayRecord} from 'sentry/views/replays/types';

import {useTrace} from './traceApi/useTrace';
import {type TraceMetaQueryResults, useTraceMeta} from './traceApi/useTraceMeta';
import {useTraceRootEvent} from './traceApi/useTraceRootEvent';
import {TraceDrawer} from './traceDrawer/traceDrawer';
import {TraceShape, TraceTree} from './traceModels/traceTree';
import type {TraceTreeNode} from './traceModels/traceTreeNode';
import {
TraceEventPriority,
type TraceEvents,
TraceScheduler,
} from 'sentry/views/performance/newTraceDetails/traceRenderers/traceScheduler';
import {TraceView as TraceViewModel} from 'sentry/views/performance/newTraceDetails/traceRenderers/traceView';
} from './traceRenderers/traceScheduler';
import {TraceView as TraceViewModel} from './traceRenderers/traceView';
import {
type ViewManagerScrollAnchor,
VirtualizedViewManager,
} from 'sentry/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager';
} from './traceRenderers/virtualizedViewManager';
import {
searchInTraceTreeText,
searchInTraceTreeTokens,
} from 'sentry/views/performance/newTraceDetails/traceSearch/traceSearchEvaluator';
import {parseTraceSearch} from 'sentry/views/performance/newTraceDetails/traceSearch/traceTokenConverter';
import {TraceShortcuts} from 'sentry/views/performance/newTraceDetails/traceShortcutsModal';
import {
TraceStateProvider,
useTraceState,
useTraceStateDispatch,
useTraceStateEmitter,
} from 'sentry/views/performance/newTraceDetails/traceState/traceStateProvider';
import {useTraceScrollToEventOnLoad} from 'sentry/views/performance/newTraceDetails/useTraceScrollToEventOnLoad';
import {useTraceScrollToPath} from 'sentry/views/performance/newTraceDetails/useTraceScrollToPath';
import type {ReplayTrace} from 'sentry/views/replays/detail/trace/useReplayTraces';
import type {ReplayRecord} from 'sentry/views/replays/types';

import {useTrace} from './traceApi/useTrace';
import {type TraceMetaQueryResults, useTraceMeta} from './traceApi/useTraceMeta';
import {useTraceRootEvent} from './traceApi/useTraceRootEvent';
import {TraceDrawer} from './traceDrawer/traceDrawer';
import {
traceNodeAdjacentAnalyticsProperties,
traceNodeAnalyticsName,
TraceTree,
type TraceTreeNode,
} from './traceModels/traceTree';
} from './traceSearch/traceSearchEvaluator';
import {TraceSearchInput} from './traceSearch/traceSearchInput';
import {parseTraceSearch} from './traceSearch/traceTokenConverter';
import {
DEFAULT_TRACE_VIEW_PREFERENCES,
loadTraceViewPreferences,
} from './traceState/tracePreferences';
import {isTraceNode} from './guards';
import {
TraceStateProvider,
useTraceState,
useTraceStateDispatch,
useTraceStateEmitter,
} from './traceState/traceStateProvider';
import {Trace} from './trace';
import {traceAnalytics} from './traceAnalytics';
import {isTraceNode} from './traceGuards';
import {TraceMetadataHeader} from './traceMetadataHeader';
import {TraceShortcuts} from './traceShortcutsModal';
import type {TraceReducer, TraceReducerState} from './traceState';
import {TraceType} from './traceType';
import {
traceNodeAdjacentAnalyticsProperties,
traceNodeAnalyticsName,
} from './traceTreeAnalytics';
import TraceTypeWarnings from './traceTypeWarnings';
import {useTraceQueryParamStateSync} from './useTraceQueryParamStateSync';
import {useTraceScrollToEventOnLoad} from './useTraceScrollToEventOnLoad';
import {useTraceScrollToPath} from './useTraceScrollToPath';

function logTraceMetadata(
tree: TraceTree,
projects: Project[],
organization: Organization
) {
switch (tree.shape) {
case TraceType.BROKEN_SUBTRACES:
case TraceType.EMPTY_TRACE:
case TraceType.MULTIPLE_ROOTS:
case TraceType.ONE_ROOT:
case TraceType.NO_ROOT:
case TraceType.ONLY_ERRORS:
case TraceType.BROWSER_MULTIPLE_ROOTS:
case TraceShape.BROKEN_SUBTRACES:
case TraceShape.EMPTY_TRACE:
case TraceShape.MULTIPLE_ROOTS:
case TraceShape.ONE_ROOT:
case TraceShape.NO_ROOT:
case TraceShape.ONLY_ERRORS:
case TraceShape.BROWSER_MULTIPLE_ROOTS:
traceAnalytics.trackTraceMetadata(tree, projects, organization);
break;
default: {
Expand Down Expand Up @@ -348,7 +347,7 @@ export function TraceViewWaterfall(props: TraceViewWaterfallProps) {

// Root frame + 2 nodes
const promises: Promise<void>[] = [];
if (trace.list.length < 4) {
if (trace.list.length <= 3) {
for (const c of trace.list) {
if (c.canFetch) {
promises.push(trace.zoomIn(c, true, {api, organization}).then(rerender));
Expand Down
3 changes: 2 additions & 1 deletion static/app/views/performance/newTraceDetails/trace.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import type {RawSpanType} from 'sentry/components/events/interfaces/spans/types'
import {EntryType, type Event, type EventTransaction} from 'sentry/types/event';
import type {TraceFullDetailed} from 'sentry/utils/performance/quickTrace/types';
import {TraceView} from 'sentry/views/performance/newTraceDetails/index';
import type {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';

import type {TraceTree} from './traceModels/traceTree';

jest.mock('screenfull', () => ({
enabled: true,
Expand Down
36 changes: 17 additions & 19 deletions static/app/views/performance/newTraceDetails/trace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,33 @@ import {replayPlayerTimestampEmitter} from 'sentry/utils/replays/replayPlayerTim
import useApi from 'sentry/utils/useApi';
import useOrganization from 'sentry/utils/useOrganization';
import useProjects from 'sentry/utils/useProjects';
import type {
TraceEvents,
TraceScheduler,
} from 'sentry/views/performance/newTraceDetails/traceRenderers/traceScheduler';

import type {TraceTree} from './traceModels/traceTree';
import type {TraceTreeNode} from './traceModels/traceTreeNode';
import type {TraceEvents, TraceScheduler} from './traceRenderers/traceScheduler';
import {
useVirtualizedList,
type VirtualizedRow,
} from 'sentry/views/performance/newTraceDetails/traceRenderers/traceVirtualizedList';
import type {VirtualizedViewManager} from 'sentry/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager';
import {TraceAutogroupedRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceAutogroupedRow';
import {TraceErrorRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceErrorRow';
import {TraceLoadingRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceLoadingRow';
import {TraceMissingInstrumentationRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceMissingInstrumentationRow';
import {TraceRootRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceRootNode';
} from './traceRenderers/traceVirtualizedList';
import type {VirtualizedViewManager} from './traceRenderers/virtualizedViewManager';
import {TraceAutogroupedRow} from './traceRow/traceAutogroupedRow';
import {TraceErrorRow} from './traceRow/traceErrorRow';
import {TraceLoadingRow} from './traceRow/traceLoadingRow';
import {TraceMissingInstrumentationRow} from './traceRow/traceMissingInstrumentationRow';
import {TraceRootRow} from './traceRow/traceRootNode';
import {
TRACE_CHILDREN_COUNT_WRAPPER_CLASSNAME,
TRACE_CHILDREN_COUNT_WRAPPER_ORPHANED_CLASSNAME,
TRACE_RIGHT_COLUMN_EVEN_CLASSNAME,
TRACE_RIGHT_COLUMN_ODD_CLASSNAME,
type TraceRowProps,
} from 'sentry/views/performance/newTraceDetails/traceRow/traceRow';
import {TraceSpanRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceSpanRow';
import {TraceTransactionRow} from 'sentry/views/performance/newTraceDetails/traceRow/traceTransactionRow';
import type {TraceReducerState} from 'sentry/views/performance/newTraceDetails/traceState';
} from './traceRow/traceRow';
import {TraceSpanRow} from './traceRow/traceSpanRow';
import {TraceTransactionRow} from './traceRow/traceTransactionRow';
import {
getRovingIndexActionFromDOMEvent,
type RovingTabIndexUserActions,
} from 'sentry/views/performance/newTraceDetails/traceState/traceRovingTabIndex';

import type {TraceTree, TraceTreeNode} from './traceModels/traceTree';
} from './traceState/traceRovingTabIndex';
import {useTraceState, useTraceStateDispatch} from './traceState/traceStateProvider';
import {
isAutogroupedNode,
Expand All @@ -59,7 +56,8 @@ import {
isTraceErrorNode,
isTraceNode,
isTransactionNode,
} from './guards';
} from './traceGuards';
import type {TraceReducerState} from './traceState';

function computeNextIndexFromAction(
current_index: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as Sentry from '@sentry/react';
import type {Organization} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import {trackAnalytics} from 'sentry/utils/analytics';
import type {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import type {TraceType} from 'sentry/views/performance/newTraceDetails/traceType';

import type {TraceShape, TraceTree} from './traceModels/traceTree';

const trackTraceMetadata = (
tree: TraceTree,
Expand Down Expand Up @@ -136,7 +136,7 @@ const trackViewShortcuts = (organization: Organization) =>
organization,
});

const trackTraceWarningType = (type: TraceType, organization: Organization) =>
const trackTraceWarningType = (type: TraceShape, organization: Organization) =>
trackAnalytics('trace.trace_warning_type', {
organization,
type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {useDiscoverQuery} from 'sentry/utils/discover/discoverQuery';
import EventView from 'sentry/utils/discover/eventView';
import {MutableSearch} from 'sentry/utils/tokenizeSearch';

import type {TraceTree, TraceTreeNode} from '../traceModels/traceTree';
import type {TraceTree} from '../traceModels/traceTree';
import type {TraceTreeNode} from '../traceModels/traceTreeNode';

type Props = {
location: Location;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type {EventTransaction} from 'sentry/types/event';
import type {Organization} from 'sentry/types/organization';
import {useApiQuery} from 'sentry/utils/queryClient';
import type {
TraceTree,
TraceTreeNode,
} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';

import type {TraceTree} from '../traceModels/traceTree';
import type {TraceTreeNode} from '../traceModels/traceTreeNode';

interface UseTransactionProps {
node: TraceTreeNode<TraceTree.Transaction> | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import type {UseApiQueryResult} from 'sentry/utils/queryClient';
import type RequestError from 'sentry/utils/requestError/requestError';
import useOrganization from 'sentry/utils/useOrganization';
import useProjects from 'sentry/utils/useProjects';
import {traceAnalytics} from 'sentry/views/performance/newTraceDetails/traceAnalytics';

import {traceAnalytics} from './traceAnalytics';

function Resource({
title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ import {generateIssueEventTarget} from 'sentry/components/quickTrace/utils';
import {t} from 'sentry/locale';
import type {EventError} from 'sentry/types/event';
import {useApiQuery} from 'sentry/utils/queryClient';
import {TraceIcons} from 'sentry/views/performance/newTraceDetails/icons';
import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';

import {
makeTraceNodeBarColor,
type TraceTree,
type TraceTreeNode,
} from '../../traceModels/traceTree';
import type {TraceTreeNodeDetailsProps} from '../../traceDrawer/tabs/traceTreeNodeDetails';
import {TraceIcons} from '../../traceIcons';
import {makeTraceNodeBarColor, type TraceTree} from '../../traceModels/traceTree';
import type {TraceTreeNode} from '../../traceModels/traceTreeNode';
import {getTraceTabTitle} from '../../traceState/traceTabs';

import {IssueList} from './issues/issues';
import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import type {
TracePerformanceIssue,
} from 'sentry/utils/performance/quickTrace/types';
import {useApiQuery} from 'sentry/utils/queryClient';
import type {
TraceTree,
TraceTreeNode,
} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';

import type {TraceTree} from '../../../traceModels/traceTree';
import type {TraceTreeNode} from '../../../traceModels/traceTreeNode';
import {TraceDrawerComponents} from '../styles';

import {IssueSummary} from './issueSummary';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import {t} from 'sentry/locale';
import getDuration from 'sentry/utils/duration/getDuration';
import {generateProfileFlamechartRouteWithQuery} from 'sentry/utils/profiling/routes';
import useProjects from 'sentry/utils/useProjects';
import {ProfilePreview} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/profiling/profilePreview';
import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';
import {ProfileGroupProvider} from 'sentry/views/profiling/profileGroupProvider';
import {ProfileContext, ProfilesProvider} from 'sentry/views/profiling/profilesProvider';

import {
makeTraceNodeBarColor,
type MissingInstrumentationNode,
} from '../../traceModels/traceTree';
import {ProfilePreview} from '../../traceDrawer/details/profiling/profilePreview';
import type {TraceTreeNodeDetailsProps} from '../../traceDrawer/tabs/traceTreeNodeDetails';
import type {MissingInstrumentationNode} from '../../traceModels/missingInstrumentationNode';
import {makeTraceNodeBarColor} from '../../traceModels/traceTree';
import {getTraceTabTitle} from '../../traceState/traceTabs';

import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import {useTheme} from '@emotion/react';

import {IconGroup} from 'sentry/icons';
import {t} from 'sentry/locale';
import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';

import {
makeTraceNodeBarColor,
type ParentAutogroupNode,
} from '../../traceModels/traceTree';
import type {TraceTreeNodeDetailsProps} from '../../traceDrawer/tabs/traceTreeNodeDetails';
import type {ParentAutogroupNode} from '../../traceModels/parentAutogroupNode';
import {makeTraceNodeBarColor} from '../../traceModels/traceTree';
import {getTraceTabTitle} from '../../traceState/traceTabs';

import {IssueList} from './issues/issues';
import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import {generateProfileFlamechartRouteWithQuery} from 'sentry/utils/profiling/ro
import {Rect} from 'sentry/utils/profiling/speedscope';
import useOrganization from 'sentry/utils/useOrganization';
import useProjects from 'sentry/utils/useProjects';
import type {
MissingInstrumentationNode,
TraceTree,
TraceTreeNode,
} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import {useProfileGroup} from 'sentry/views/profiling/profileGroupProvider';
import {useProfiles} from 'sentry/views/profiling/profilesProvider';

import type {MissingInstrumentationNode} from '../../../traceModels/missingInstrumentationNode';
import type {TraceTree} from '../../../traceModels/traceTree';
import type {TraceTreeNode} from '../../../traceModels/traceTreeNode';

interface SpanProfileProps {
event: Readonly<EventTransaction>;
node: TraceTreeNode<TraceTree.Span> | MissingInstrumentationNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import {useTheme} from '@emotion/react';

import {IconGroup} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';

import {
makeTraceNodeBarColor,
type SiblingAutogroupNode,
} from '../../traceModels/traceTree';
import type {TraceTreeNodeDetailsProps} from '../../traceDrawer/tabs/traceTreeNodeDetails';
import type {SiblingAutogroupNode} from '../../traceModels/siblingAutogroupNode';
import {makeTraceNodeBarColor} from '../../traceModels/traceTree';
import {getTraceTabTitle} from '../../traceState/traceTabs';

import {IssueList} from './issues/issues';
import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';
Expand Down
Loading

0 comments on commit 356f41d

Please sign in to comment.