trace.tsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569
  1. import type React from 'react';
  2. import {
  3. Fragment,
  4. useCallback,
  5. useEffect,
  6. useLayoutEffect,
  7. useMemo,
  8. useRef,
  9. useState,
  10. } from 'react';
  11. import {type Theme, useTheme} from '@emotion/react';
  12. import styled from '@emotion/styled';
  13. import ConfigStore from 'sentry/stores/configStore';
  14. import {space} from 'sentry/styles/space';
  15. import type {Organization} from 'sentry/types/organization';
  16. import type {PlatformKey, Project} from 'sentry/types/project';
  17. import {trackAnalytics} from 'sentry/utils/analytics';
  18. import {formatTraceDuration} from 'sentry/utils/duration/formatTraceDuration';
  19. import {replayPlayerTimestampEmitter} from 'sentry/utils/replays/replayPlayerTimestampEmitter';
  20. import useApi from 'sentry/utils/useApi';
  21. import useOrganization from 'sentry/utils/useOrganization';
  22. import useProjects from 'sentry/utils/useProjects';
  23. import {TraceTree} from './traceModels/traceTree';
  24. import type {TraceTreeNode} from './traceModels/traceTreeNode';
  25. import type {TraceEvents, TraceScheduler} from './traceRenderers/traceScheduler';
  26. import {
  27. useVirtualizedList,
  28. type VirtualizedRow,
  29. } from './traceRenderers/traceVirtualizedList';
  30. import type {VirtualizedViewManager} from './traceRenderers/virtualizedViewManager';
  31. import {TraceAutogroupedRow} from './traceRow/traceAutogroupedRow';
  32. import {TraceCollapsedRow} from './traceRow/traceCollapsedRow';
  33. import {TraceErrorRow} from './traceRow/traceErrorRow';
  34. import {TraceLoadingRow} from './traceRow/traceLoadingRow';
  35. import {TraceMissingInstrumentationRow} from './traceRow/traceMissingInstrumentationRow';
  36. import {TraceRootRow} from './traceRow/traceRootNode';
  37. import {
  38. TRACE_CHILDREN_COUNT_WRAPPER_CLASSNAME,
  39. TRACE_CHILDREN_COUNT_WRAPPER_ORPHANED_CLASSNAME,
  40. TRACE_RIGHT_COLUMN_EVEN_CLASSNAME,
  41. TRACE_RIGHT_COLUMN_ODD_CLASSNAME,
  42. type TraceRowProps,
  43. } from './traceRow/traceRow';
  44. import {TraceSpanRow} from './traceRow/traceSpanRow';
  45. import {TraceTransactionRow} from './traceRow/traceTransactionRow';
  46. import {
  47. getRovingIndexActionFromDOMEvent,
  48. type RovingTabIndexUserActions,
  49. } from './traceState/traceRovingTabIndex';
  50. import {useTraceState, useTraceStateDispatch} from './traceState/traceStateProvider';
  51. import {
  52. isAutogroupedNode,
  53. isCollapsedNode,
  54. isMissingInstrumentationNode,
  55. isSpanNode,
  56. isTraceErrorNode,
  57. isTraceNode,
  58. isTransactionNode,
  59. } from './traceGuards';
  60. import type {TraceReducerState} from './traceState';
  61. function computeNextIndexFromAction(
  62. current_index: number,
  63. action: RovingTabIndexUserActions,
  64. items: number
  65. ): number {
  66. switch (action) {
  67. case 'next':
  68. if (current_index === items) {
  69. return 0;
  70. }
  71. return current_index + 1;
  72. case 'previous':
  73. if (current_index === 0) {
  74. return items;
  75. }
  76. return current_index - 1;
  77. case 'last':
  78. return items;
  79. case 'first':
  80. return 0;
  81. default:
  82. throw new TypeError(`Invalid or not implemented reducer action - ${action}`);
  83. }
  84. }
  85. interface TraceProps {
  86. forceRerender: number;
  87. isLoading: boolean;
  88. manager: VirtualizedViewManager;
  89. onRowClick: (
  90. node: TraceTreeNode<TraceTree.NodeValue>,
  91. event: React.MouseEvent<HTMLElement>,
  92. index: number
  93. ) => void;
  94. onTraceSearch: (
  95. query: string,
  96. node: TraceTreeNode<TraceTree.NodeValue>,
  97. behavior: 'track result' | 'persist'
  98. ) => void;
  99. previouslyFocusedNodeRef: React.MutableRefObject<TraceTreeNode<TraceTree.NodeValue> | null>;
  100. rerender: () => void;
  101. scheduler: TraceScheduler;
  102. trace: TraceTree;
  103. trace_id: string | undefined;
  104. }
  105. export function Trace({
  106. trace,
  107. onRowClick,
  108. manager,
  109. previouslyFocusedNodeRef,
  110. onTraceSearch,
  111. rerender,
  112. scheduler,
  113. forceRerender,
  114. trace_id,
  115. isLoading,
  116. }: TraceProps) {
  117. const theme = useTheme();
  118. const api = useApi();
  119. const {projects} = useProjects();
  120. const organization = useOrganization();
  121. const traceState = useTraceState();
  122. const traceDispatch = useTraceStateDispatch();
  123. const rerenderRef = useRef<TraceProps['rerender']>(rerender);
  124. rerenderRef.current = rerender;
  125. const treePromiseStatusRef =
  126. useRef<Map<TraceTreeNode<TraceTree.NodeValue>, 'loading' | 'error' | 'success'>>();
  127. if (!treePromiseStatusRef.current) {
  128. treePromiseStatusRef.current = new Map();
  129. }
  130. const treeRef = useRef<TraceTree>(trace);
  131. treeRef.current = trace;
  132. const traceStateRef = useRef<TraceReducerState>(traceState);
  133. traceStateRef.current = traceState;
  134. const traceStatePreferencesRef = useRef<
  135. Pick<TraceReducerState['preferences'], 'autogroup' | 'missing_instrumentation'>
  136. >(traceState.preferences);
  137. traceStatePreferencesRef.current = traceState.preferences;
  138. useLayoutEffect(() => {
  139. const onTraceViewChange: TraceEvents['set trace view'] = () => {
  140. manager.recomputeTimelineIntervals();
  141. manager.recomputeSpanToPXMatrix();
  142. manager.syncResetZoomButton();
  143. manager.draw();
  144. };
  145. const onPhysicalSpaceChange: TraceEvents['set container physical space'] = () => {
  146. manager.recomputeTimelineIntervals();
  147. manager.recomputeSpanToPXMatrix();
  148. manager.draw();
  149. };
  150. const onTraceSpaceChange: TraceEvents['initialize trace space'] = () => {
  151. manager.recomputeTimelineIntervals();
  152. manager.recomputeSpanToPXMatrix();
  153. manager.draw();
  154. };
  155. const onDividerResize: TraceEvents['divider resize'] = view => {
  156. manager.recomputeTimelineIntervals();
  157. manager.recomputeSpanToPXMatrix();
  158. manager.draw(view);
  159. };
  160. scheduler.on('set trace view', onTraceViewChange);
  161. scheduler.on('set trace space', onTraceSpaceChange);
  162. scheduler.on('set container physical space', onPhysicalSpaceChange);
  163. scheduler.on('initialize trace space', onTraceSpaceChange);
  164. scheduler.on('divider resize', onDividerResize);
  165. return () => {
  166. scheduler.off('set trace view', onTraceViewChange);
  167. scheduler.off('set trace space', onTraceSpaceChange);
  168. scheduler.off('set container physical space', onPhysicalSpaceChange);
  169. scheduler.off('initialize trace space', onTraceSpaceChange);
  170. scheduler.off('divider resize', onDividerResize);
  171. };
  172. }, [manager, scheduler]);
  173. const onNodeZoomIn = useCallback(
  174. (
  175. event: React.MouseEvent<Element> | React.KeyboardEvent<Element>,
  176. node: TraceTreeNode<TraceTree.NodeValue>,
  177. value: boolean
  178. ) => {
  179. if (!isTransactionNode(node) && !isSpanNode(node)) {
  180. throw new TypeError('Node must be a transaction or span');
  181. }
  182. event.stopPropagation();
  183. rerenderRef.current();
  184. treeRef.current
  185. .zoom(node, value, {
  186. api,
  187. organization,
  188. preferences: traceStatePreferencesRef.current,
  189. })
  190. .then(() => {
  191. rerenderRef.current();
  192. // If a query exists, we want to reapply the search after zooming in
  193. // so that new nodes are also highlighted if they match a query
  194. if (traceStateRef.current.search.query) {
  195. onTraceSearch(traceStateRef.current.search.query, node, 'persist');
  196. }
  197. treePromiseStatusRef.current!.set(node, 'success');
  198. })
  199. .catch(_e => {
  200. treePromiseStatusRef.current!.set(node, 'error');
  201. });
  202. },
  203. [api, organization, onTraceSearch]
  204. );
  205. const onNodeExpand = useCallback(
  206. (
  207. event: React.MouseEvent<Element> | React.KeyboardEvent<Element>,
  208. node: TraceTreeNode<TraceTree.NodeValue>,
  209. value: boolean
  210. ) => {
  211. event.stopPropagation();
  212. treeRef.current.expand(node, value);
  213. rerenderRef.current();
  214. if (traceStateRef.current.search.query) {
  215. // If a query exists, we want to reapply the search after expanding
  216. // so that new nodes are also highlighted if they match a query
  217. onTraceSearch(traceStateRef.current.search.query, node, 'persist');
  218. }
  219. },
  220. [onTraceSearch]
  221. );
  222. const onRowKeyDown = useCallback(
  223. (
  224. event: React.KeyboardEvent,
  225. index: number,
  226. node: TraceTreeNode<TraceTree.NodeValue>
  227. ) => {
  228. if (!manager.list) {
  229. return;
  230. }
  231. const action = getRovingIndexActionFromDOMEvent(event);
  232. if (action) {
  233. event.preventDefault();
  234. const nextIndex = computeNextIndexFromAction(
  235. index,
  236. action,
  237. treeRef.current.list.length - 1
  238. );
  239. traceDispatch({
  240. type: 'set roving index',
  241. index: nextIndex,
  242. node: treeRef.current.list[nextIndex],
  243. action_source: 'keyboard',
  244. });
  245. }
  246. if (event.key === 'ArrowLeft') {
  247. if (node.zoomedIn) {
  248. onNodeZoomIn(event, node, false);
  249. } else if (node.expanded) {
  250. onNodeExpand(event, node, false);
  251. }
  252. } else if (event.key === 'ArrowRight') {
  253. if (node.canFetch) {
  254. onNodeZoomIn(event, node, true);
  255. } else {
  256. onNodeExpand(event, node, true);
  257. }
  258. }
  259. },
  260. [manager, onNodeExpand, onNodeZoomIn, traceDispatch]
  261. );
  262. const projectLookup: Record<string, PlatformKey | undefined> = useMemo(() => {
  263. return projects.reduce<Record<Project['slug'], Project['platform']>>(
  264. (acc, project) => {
  265. acc[project.slug] = project.platform;
  266. return acc;
  267. },
  268. {}
  269. );
  270. }, [projects]);
  271. const renderLoadingRow = useCallback(
  272. (n: VirtualizedRow) => {
  273. return (
  274. <TraceLoadingRow
  275. key={n.key}
  276. index={n.index}
  277. style={n.style}
  278. node={n.item}
  279. theme={theme}
  280. manager={manager}
  281. />
  282. );
  283. },
  284. [manager, theme]
  285. );
  286. const renderVirtualizedRow = useCallback(
  287. (n: VirtualizedRow) => {
  288. return (
  289. <RenderTraceRow
  290. key={n.key}
  291. index={n.index}
  292. organization={organization}
  293. previouslyFocusedNodeRef={previouslyFocusedNodeRef}
  294. tabIndex={traceState.rovingTabIndex.node === n.item ? 0 : -1}
  295. isSearchResult={traceState.search.resultsLookup.has(n.item)}
  296. searchResultsIteratorIndex={traceState.search.resultIndex}
  297. style={n.style}
  298. projects={projectLookup}
  299. node={n.item}
  300. manager={manager}
  301. theme={theme}
  302. onExpand={onNodeExpand}
  303. onZoomIn={onNodeZoomIn}
  304. onRowClick={onRowClick}
  305. onRowKeyDown={onRowKeyDown}
  306. tree={trace}
  307. trace_id={trace_id}
  308. />
  309. );
  310. },
  311. // we add forceRerender as a "unnecessary" dependency to trigger the virtualized list rerender
  312. // eslint-disable-next-line react-hooks/exhaustive-deps
  313. [
  314. onNodeExpand,
  315. onNodeZoomIn,
  316. manager,
  317. previouslyFocusedNodeRef,
  318. onRowKeyDown,
  319. onRowClick,
  320. organization,
  321. projectLookup,
  322. traceState.rovingTabIndex.node,
  323. traceState.search.resultIteratorIndex,
  324. traceState.search.resultsLookup,
  325. traceState.search.resultIndex,
  326. theme,
  327. trace.type,
  328. forceRerender,
  329. ]
  330. );
  331. const render = useMemo(() => {
  332. return trace.type !== 'trace' || isLoading
  333. ? r => renderLoadingRow(r)
  334. : r => renderVirtualizedRow(r);
  335. }, [isLoading, renderLoadingRow, renderVirtualizedRow, trace.type]);
  336. const traceNode = trace.root.children[0];
  337. const traceStartTimestamp = traceNode?.space?.[0];
  338. const [scrollContainer, setScrollContainer] = useState<HTMLElement | null>(null);
  339. const virtualizedList = useVirtualizedList({
  340. manager,
  341. items: trace.list,
  342. container: scrollContainer,
  343. render: render,
  344. scheduler,
  345. });
  346. return (
  347. <TraceStylingWrapper
  348. ref={manager.registerContainerRef}
  349. className={`
  350. ${trace.root.space[1] === 0 ? 'Empty' : ''}
  351. ${trace.indicators.length > 0 ? 'WithIndicators' : ''}
  352. ${trace.type !== 'trace' || isLoading ? 'Loading' : ''}
  353. ${ConfigStore.get('theme')}`}
  354. >
  355. <div
  356. className="TraceScrollbarContainer"
  357. ref={manager.registerHorizontalScrollBarContainerRef}
  358. >
  359. <div className="TraceScrollbarScroller" />
  360. </div>
  361. <div className="TraceDivider" ref={manager.registerDividerRef} />
  362. <div
  363. className="TraceIndicatorContainer"
  364. ref={manager.registerIndicatorContainerRef}
  365. >
  366. {trace.indicators.length > 0
  367. ? trace.indicators.map((indicator, i) => {
  368. return (
  369. <div
  370. key={i}
  371. ref={r => manager.registerIndicatorRef(r, i, indicator)}
  372. className={`TraceIndicator ${indicator.poor ? 'Errored' : ''}`}
  373. >
  374. <div className="TraceIndicatorLabel">{indicator.label}</div>
  375. <div className="TraceIndicatorLine" />
  376. </div>
  377. );
  378. })
  379. : null}
  380. {manager.interval_bars.map((_, i) => {
  381. const indicatorTimestamp = manager.intervals[i] ?? 0;
  382. if (trace.type !== 'trace' || isLoading) {
  383. return null;
  384. }
  385. return (
  386. <div
  387. key={i}
  388. ref={r => manager.registerTimelineIndicatorRef(r, i)}
  389. className="TraceIndicator Timeline"
  390. >
  391. <div className="TraceIndicatorLabel">
  392. {indicatorTimestamp > 0
  393. ? formatTraceDuration(manager.view.trace_view.x + indicatorTimestamp)
  394. : '0s'}
  395. </div>
  396. <div className="TraceIndicatorLine" />
  397. </div>
  398. );
  399. })}
  400. {traceNode && traceStartTimestamp ? (
  401. <VerticalTimestampIndicators
  402. viewmanager={manager}
  403. traceStartTimestamp={traceStartTimestamp}
  404. />
  405. ) : null}
  406. </div>
  407. <div
  408. ref={setScrollContainer}
  409. data-test-id="trace-virtualized-list-scroll-container"
  410. >
  411. <div data-test-id="trace-virtualized-list">{virtualizedList.rendered}</div>
  412. <div className="TraceRow Hidden">
  413. <div
  414. className="TraceLeftColumn"
  415. ref={r => manager.registerGhostRowRef('list', r)}
  416. />
  417. <div
  418. className="TraceRightColumn"
  419. ref={r => manager.registerGhostRowRef('span_list', r)}
  420. />
  421. </div>
  422. </div>
  423. </TraceStylingWrapper>
  424. );
  425. }
  426. function RenderTraceRow(props: {
  427. index: number;
  428. isSearchResult: boolean;
  429. manager: VirtualizedViewManager;
  430. node: TraceTreeNode<TraceTree.NodeValue>;
  431. onExpand: (
  432. event: React.MouseEvent<Element>,
  433. node: TraceTreeNode<TraceTree.NodeValue>,
  434. value: boolean
  435. ) => void;
  436. onRowClick: (
  437. node: TraceTreeNode<TraceTree.NodeValue>,
  438. event: React.MouseEvent<HTMLElement>,
  439. index: number
  440. ) => void;
  441. onRowKeyDown: (
  442. event: React.KeyboardEvent,
  443. index: number,
  444. node: TraceTreeNode<TraceTree.NodeValue>
  445. ) => void;
  446. onZoomIn: (
  447. event: React.MouseEvent<Element>,
  448. node: TraceTreeNode<TraceTree.NodeValue>,
  449. value: boolean
  450. ) => void;
  451. organization: Organization;
  452. previouslyFocusedNodeRef: React.MutableRefObject<TraceTreeNode<TraceTree.NodeValue> | null>;
  453. projects: Record<Project['slug'], Project['platform']>;
  454. searchResultsIteratorIndex: number | null;
  455. style: React.CSSProperties;
  456. tabIndex: number;
  457. theme: Theme;
  458. trace_id: string | undefined;
  459. tree: TraceTree;
  460. }) {
  461. const node = props.node;
  462. const virtualized_index = props.index - props.manager.start_virtualized_index;
  463. const rowSearchClassName = `${props.isSearchResult ? 'SearchResult' : ''} ${props.searchResultsIteratorIndex === props.index ? 'Highlight' : ''}`;
  464. const registerListColumnRef = useCallback(
  465. (ref: HTMLDivElement | null) => {
  466. props.manager.registerColumnRef('list', ref, virtualized_index, node);
  467. },
  468. [props.manager, node, virtualized_index]
  469. );
  470. const registerSpanColumnRef = useCallback(
  471. (ref: HTMLDivElement | null) => {
  472. props.manager.registerColumnRef('span_list', ref, virtualized_index, node);
  473. },
  474. [props.manager, node, virtualized_index]
  475. );
  476. const registerSpanArrowRef = useCallback(
  477. ref => {
  478. props.manager.registerArrowRef(ref, node.space!, virtualized_index);
  479. },
  480. [props.manager, node, virtualized_index]
  481. );
  482. const onRowClickProp = props.onRowClick;
  483. const onRowClick = useCallback(
  484. (event: React.MouseEvent<HTMLElement>) => {
  485. onRowClickProp(node, event, props.index);
  486. },
  487. [props.index, node, onRowClickProp]
  488. );
  489. const onRowKeyDownProp = props.onRowKeyDown;
  490. const onRowKeyDown = useCallback(
  491. (event: React.KeyboardEvent) => onRowKeyDownProp(event, props.index, node),
  492. [props.index, node, onRowKeyDownProp]
  493. );
  494. const onRowDoubleClick = useCallback(
  495. (e: React.MouseEvent) => {
  496. trackAnalytics('trace.trace_layout.zoom_to_fill', {
  497. organization: props.organization,
  498. });
  499. e.stopPropagation();
  500. props.manager.onZoomIntoSpace(node.space!);
  501. },
  502. [node, props.manager, props.organization]
  503. );
  504. const onSpanRowArrowClick = useCallback(
  505. (_e: React.MouseEvent) => {
  506. props.manager.onBringRowIntoView(node.space!);
  507. },
  508. [node.space, props.manager]
  509. );
  510. const onExpandProp = props.onExpand;
  511. const onExpand = useCallback(
  512. (e: React.MouseEvent) => {
  513. onExpandProp(e, node, !node.expanded);
  514. },
  515. [node, onExpandProp]
  516. );
  517. const onZoomInProp = props.onZoomIn;
  518. const onZoomIn = useCallback(
  519. (e: React.MouseEvent) => {
  520. onZoomInProp(e, node, !node.zoomedIn);
  521. },
  522. [node, onZoomInProp]
  523. );
  524. const onExpandDoubleClick = useCallback((e: React.MouseEvent) => {
  525. e.stopPropagation();
  526. }, []);
  527. const spanColumnClassName =
  528. props.index % 2 === 1
  529. ? TRACE_RIGHT_COLUMN_ODD_CLASSNAME
  530. : TRACE_RIGHT_COLUMN_EVEN_CLASSNAME;
  531. const listColumnClassName = isTraceNode(node)
  532. ? TRACE_CHILDREN_COUNT_WRAPPER_ORPHANED_CLASSNAME
  533. : TRACE_CHILDREN_COUNT_WRAPPER_CLASSNAME;
  534. const listColumnStyle: React.CSSProperties = {
  535. paddingLeft: TraceTree.Depth(node) * props.manager.row_depth_padding,
  536. };
  537. const rowProps: TraceRowProps<TraceTreeNode<TraceTree.NodeValue>> = {
  538. onExpand,
  539. onZoomIn,
  540. onRowClick,
  541. onRowKeyDown,
  542. previouslyFocusedNodeRef: props.previouslyFocusedNodeRef,
  543. onSpanArrowClick: onSpanRowArrowClick,
  544. manager: props.manager,
  545. index: props.index,
  546. theme: props.theme,
  547. style: props.style,
  548. projects: props.projects,
  549. tabIndex: props.tabIndex,
  550. onRowDoubleClick,
  551. trace_id: props.trace_id,
  552. node: props.node,
  553. virtualized_index,
  554. listColumnStyle,
  555. listColumnClassName,
  556. spanColumnClassName,
  557. onExpandDoubleClick,
  558. rowSearchClassName,
  559. registerListColumnRef,
  560. registerSpanColumnRef,
  561. registerSpanArrowRef,
  562. };
  563. if (isTransactionNode(node)) {
  564. return <TraceTransactionRow {...rowProps} node={node} />;
  565. }
  566. if (isSpanNode(node)) {
  567. return <TraceSpanRow {...rowProps} node={node} />;
  568. }
  569. if (isMissingInstrumentationNode(node)) {
  570. return <TraceMissingInstrumentationRow {...rowProps} node={node} />;
  571. }
  572. if (isAutogroupedNode(node)) {
  573. return <TraceAutogroupedRow {...rowProps} node={node} />;
  574. }
  575. if (isTraceErrorNode(node)) {
  576. return <TraceErrorRow {...rowProps} node={node} />;
  577. }
  578. if (isTraceNode(node)) {
  579. return <TraceRootRow {...rowProps} node={node} />;
  580. }
  581. if (isCollapsedNode(node)) {
  582. return <TraceCollapsedRow {...rowProps} node={node} />;
  583. }
  584. return null;
  585. }
  586. function VerticalTimestampIndicators({
  587. viewmanager,
  588. traceStartTimestamp,
  589. }: {
  590. traceStartTimestamp: number;
  591. viewmanager: VirtualizedViewManager;
  592. }) {
  593. useEffect(() => {
  594. function replayTimestampListener({
  595. currentTime,
  596. currentHoverTime,
  597. }: {
  598. currentHoverTime: number | undefined;
  599. currentTime: number;
  600. }) {
  601. if (viewmanager.vertical_indicators['replay_timestamp.current']) {
  602. viewmanager.vertical_indicators['replay_timestamp.current'].timestamp =
  603. traceStartTimestamp + currentTime;
  604. }
  605. if (viewmanager.vertical_indicators['replay_timestamp.hover']) {
  606. viewmanager.vertical_indicators['replay_timestamp.hover'].timestamp =
  607. currentHoverTime ? traceStartTimestamp + currentHoverTime : undefined;
  608. }
  609. // When timestamp is changing, it needs to be redrawn
  610. // if it is out of bounds, we need to scroll to it
  611. viewmanager.drawVerticalIndicators();
  612. viewmanager.maybeSyncViewWithVerticalIndicator('replay_timestamp.current');
  613. }
  614. replayPlayerTimestampEmitter.on('replay timestamp change', replayTimestampListener);
  615. return () => {
  616. replayPlayerTimestampEmitter.off(
  617. 'replay timestamp change',
  618. replayTimestampListener
  619. );
  620. };
  621. }, [traceStartTimestamp, viewmanager]);
  622. const registerReplayCurrentTimestampRef = useCallback(
  623. (ref: HTMLDivElement | null) => {
  624. viewmanager.registerVerticalIndicator('replay_timestamp.current', {
  625. ref,
  626. timestamp: undefined,
  627. });
  628. },
  629. [viewmanager]
  630. );
  631. const registerReplayHoverTimestampRef = useCallback(
  632. (ref: HTMLDivElement | null) => {
  633. viewmanager.registerVerticalIndicator('replay_timestamp.hover', {
  634. ref,
  635. timestamp: undefined,
  636. });
  637. },
  638. [viewmanager]
  639. );
  640. return (
  641. <Fragment>
  642. <div ref={registerReplayCurrentTimestampRef} className="TraceIndicator Timeline">
  643. <div className="Indicator CurrentReplayTimestamp" />
  644. </div>
  645. <div ref={registerReplayHoverTimestampRef} className="TraceIndicator Timeline">
  646. <div className="Indicator HoverReplayTimestamp" />
  647. </div>
  648. </Fragment>
  649. );
  650. }
  651. /**
  652. * This is a wrapper around the Trace component to apply styles
  653. * to the trace tree. It exists because we _do not_ want to trigger
  654. * emotion's css parsing logic as it is very slow and will cause
  655. * the scrolling to flicker.
  656. */
  657. const TraceStylingWrapper = styled('div')`
  658. margin: auto;
  659. overscroll-behavior: none;
  660. box-shadow: 0 0 0 1px ${p => p.theme.border};
  661. position: absolute;
  662. left: 0;
  663. top: 0;
  664. width: 100%;
  665. height: 100%;
  666. grid-area: trace;
  667. padding-top: 26px;
  668. &.WithIndicators {
  669. padding-top: 44px;
  670. &:before {
  671. height: 44px;
  672. .TraceScrollbarContainer {
  673. height: 44px;
  674. }
  675. }
  676. .TraceIndicator.Timeline {
  677. .TraceIndicatorLabel {
  678. top: 26px;
  679. }
  680. .TraceIndicatorLine {
  681. top: 30px;
  682. }
  683. .Indicator {
  684. top: 44px;
  685. }
  686. }
  687. }
  688. &:before {
  689. content: '';
  690. position: absolute;
  691. left: 0;
  692. top: 0;
  693. width: 100%;
  694. height: 26px;
  695. background-color: ${p => p.theme.backgroundSecondary};
  696. border-bottom: 1px solid ${p => p.theme.border};
  697. }
  698. &.Loading {
  699. .TraceRow {
  700. .TraceLeftColumnInner {
  701. width: 100%;
  702. }
  703. }
  704. .TraceRightColumn {
  705. background-color: transparent !important;
  706. }
  707. .TraceDivider {
  708. pointer-events: none;
  709. }
  710. }
  711. &.Empty {
  712. .TraceIcon {
  713. left: 50%;
  714. }
  715. }
  716. .TraceScrollbarContainer {
  717. left: 0;
  718. top: 0;
  719. height: 26px;
  720. position: absolute;
  721. overflow-x: auto;
  722. overscroll-behavior: none;
  723. will-change: transform;
  724. .TraceScrollbarScroller {
  725. height: 1px;
  726. pointer-events: none;
  727. visibility: hidden;
  728. }
  729. .TraceScrollbarHandle {
  730. width: 24px;
  731. height: 12px;
  732. border-radius: 6px;
  733. }
  734. }
  735. .TraceDivider {
  736. position: absolute;
  737. height: 100%;
  738. background-color: transparent;
  739. top: 0;
  740. cursor: ew-resize;
  741. z-index: 10;
  742. &:before {
  743. content: '';
  744. position: absolute;
  745. width: 1px;
  746. height: 100%;
  747. background-color: ${p => p.theme.border};
  748. left: 50%;
  749. }
  750. &:hover {
  751. &:before {
  752. background-color: ${p => p.theme.purple300};
  753. }
  754. }
  755. }
  756. .TraceIndicatorContainer {
  757. overflow: hidden;
  758. width: 100%;
  759. height: 100%;
  760. position: absolute;
  761. right: 0;
  762. top: 0;
  763. z-index: 10;
  764. pointer-events: none;
  765. }
  766. .TraceIndicator {
  767. z-index: 1;
  768. width: 3px;
  769. height: 100%;
  770. top: 0;
  771. position: absolute;
  772. &:hover {
  773. z-index: 10;
  774. }
  775. .TraceIndicatorLabel {
  776. min-width: 34px;
  777. text-align: center;
  778. position: absolute;
  779. font-size: 10px;
  780. font-weight: ${p => p.theme.fontWeightBold};
  781. color: ${p => p.theme.textColor};
  782. background-color: ${p => p.theme.background};
  783. border-radius: ${p => p.theme.borderRadius};
  784. border: 1px solid ${p => p.theme.border};
  785. padding: 2px;
  786. display: inline-block;
  787. line-height: 1;
  788. margin-top: 2px;
  789. white-space: nowrap;
  790. }
  791. .TraceIndicatorLine {
  792. width: 1px;
  793. height: 100%;
  794. top: 20px;
  795. position: absolute;
  796. left: 50%;
  797. transform: translateX(-2px);
  798. background: repeating-linear-gradient(
  799. to bottom,
  800. transparent 0 4px,
  801. ${p => p.theme.textColor} 4px 8px
  802. )
  803. 80%/2px 100% no-repeat;
  804. }
  805. .Indicator {
  806. width: 1px;
  807. height: 100%;
  808. position: absolute;
  809. left: 50%;
  810. transform: translateX(-2px);
  811. top: 26px;
  812. &.CurrentReplayTimestamp {
  813. background: ${p => p.theme.purple300};
  814. }
  815. &.HoverReplayTimestamp {
  816. background: ${p => p.theme.purple200};
  817. }
  818. }
  819. &.Errored {
  820. .TraceIndicatorLabel {
  821. border: 1px solid ${p => p.theme.error};
  822. color: ${p => p.theme.error};
  823. }
  824. .TraceIndicatorLine {
  825. background: repeating-linear-gradient(
  826. to bottom,
  827. transparent 0 4px,
  828. ${p => p.theme.error} 4px 8px
  829. )
  830. 80%/2px 100% no-repeat;
  831. }
  832. }
  833. &.Timeline {
  834. opacity: 1;
  835. z-index: 1;
  836. pointer-events: none;
  837. .TraceIndicatorLabel {
  838. font-weight: ${p => p.theme.fontWeightNormal};
  839. min-width: 0;
  840. top: 8px;
  841. width: auto;
  842. border: none;
  843. background-color: transparent;
  844. color: ${p => p.theme.subText};
  845. }
  846. .TraceIndicatorLine {
  847. background: ${p => p.theme.translucentGray100};
  848. top: 8px;
  849. }
  850. }
  851. }
  852. &.light {
  853. .TracePattern {
  854. &.info {
  855. --pattern-odd: #d1dff9;
  856. --pattern-even: ${p => p.theme.blue300};
  857. }
  858. &.warning {
  859. --pattern-odd: #a5752c;
  860. --pattern-even: ${p => p.theme.yellow300};
  861. }
  862. &.performance_issue {
  863. --pattern-odd: #063690;
  864. --pattern-even: ${p => p.theme.blue300};
  865. }
  866. &.profile {
  867. --pattern-odd: rgba(58, 17, 95, 0.55);
  868. --pattern-even: transparent;
  869. }
  870. &.missing_instrumentation {
  871. --pattern-odd: #dedae3;
  872. --pattern-even: #f4f2f7;
  873. }
  874. &.error,
  875. &.fatal {
  876. --pattern-odd: #872d32;
  877. --pattern-even: ${p => p.theme.red300};
  878. }
  879. /* false positive for grid layout */
  880. /* stylelint-disable */
  881. &.default {
  882. }
  883. &.unknown {
  884. }
  885. /* stylelint-enable */
  886. }
  887. }
  888. &.dark {
  889. .TracePattern {
  890. &.info {
  891. --pattern-odd: #d1dff9;
  892. --pattern-even: ${p => p.theme.blue300};
  893. }
  894. &.warning {
  895. --pattern-odd: #a5752c;
  896. --pattern-even: ${p => p.theme.yellow300};
  897. }
  898. &.performance_issue {
  899. --pattern-odd: #063690;
  900. --pattern-even: ${p => p.theme.blue300};
  901. }
  902. &.profile {
  903. --pattern-odd: rgba(58, 17, 95, 0.55);
  904. --pattern-even: transparent;
  905. }
  906. &.missing_instrumentation {
  907. --pattern-odd: #4b4550;
  908. --pattern-even: #1c1521;
  909. }
  910. &.error,
  911. &.fatal {
  912. --pattern-odd: #510d10;
  913. --pattern-even: ${p => p.theme.red300};
  914. }
  915. /* stylelint-disable */
  916. &.default {
  917. }
  918. &.unknown {
  919. }
  920. /* stylelint-enable */
  921. }
  922. }
  923. .TraceRow {
  924. display: flex;
  925. align-items: center;
  926. position: absolute;
  927. height: 24px;
  928. width: 100%;
  929. transition: none;
  930. font-size: ${p => p.theme.fontSizeSmall};
  931. transform: translateZ(0);
  932. --row-background-odd: ${p => p.theme.translucentSurface100};
  933. --row-background-hover: ${p => p.theme.translucentSurface100};
  934. --row-background-focused: ${p => p.theme.translucentSurface200};
  935. --row-outline: ${p => p.theme.blue300};
  936. --row-children-button-border-color: ${p => p.theme.border};
  937. /* allow empty blocks so we can keep an exhaustive list of classnames for future reference */
  938. /* stylelint-disable */
  939. &.info {
  940. }
  941. &.warning {
  942. }
  943. &.debug {
  944. }
  945. &.error,
  946. &.fatal,
  947. &.performance_issue {
  948. color: ${p => p.theme.errorText};
  949. --autogrouped: ${p => p.theme.error};
  950. --row-children-button-border-color: ${p => p.theme.error};
  951. --row-outline: ${p => p.theme.error};
  952. }
  953. &.default {
  954. }
  955. &.unknown {
  956. }
  957. &.Hidden {
  958. position: absolute;
  959. height: 100%;
  960. width: 100%;
  961. top: 0;
  962. z-index: -1;
  963. &:hover {
  964. background-color: transparent;
  965. }
  966. * {
  967. cursor: default !important;
  968. }
  969. }
  970. .TraceIcon {
  971. position: absolute;
  972. top: 50%;
  973. transform: translate(-50%, -50%) scaleX(var(--inverse-span-scale)) translateZ(0);
  974. background-color: ${p => p.theme.background};
  975. width: 18px !important;
  976. height: 18px !important;
  977. border-radius: 50%;
  978. display: flex;
  979. align-items: center;
  980. justify-content: center;
  981. z-index: 1;
  982. &.info {
  983. background-color: var(--info);
  984. }
  985. &.warning {
  986. background-color: var(--warning);
  987. }
  988. &.debug {
  989. background-color: var(--debug);
  990. }
  991. &.error,
  992. &.fatal {
  993. background-color: var(--error);
  994. }
  995. &.performance_issue {
  996. background-color: var(--performance-issue);
  997. }
  998. &.default {
  999. background-color: var(--default);
  1000. }
  1001. &.unknown {
  1002. background-color: var(--unknown);
  1003. }
  1004. &.profile {
  1005. background-color: var(--profile);
  1006. }
  1007. svg {
  1008. width: 12px;
  1009. height: 12px;
  1010. fill: ${p => p.theme.white};
  1011. }
  1012. &.profile svg {
  1013. margin-left: 2px;
  1014. }
  1015. &.info,
  1016. &.warning,
  1017. &.performance_issue,
  1018. &.default,
  1019. &.unknown {
  1020. svg {
  1021. transform: translateY(-1px);
  1022. }
  1023. }
  1024. }
  1025. .TracePatternContainer {
  1026. position: absolute;
  1027. width: 100%;
  1028. height: 100%;
  1029. overflow: hidden;
  1030. }
  1031. .TracePattern {
  1032. left: 0;
  1033. width: 1000000px;
  1034. height: 100%;
  1035. position: absolute;
  1036. transform-origin: left center;
  1037. transform: scaleX(var(--inverse-span-scale)) translateZ(0);
  1038. background-image: linear-gradient(
  1039. 135deg,
  1040. var(--pattern-even) 1%,
  1041. var(--pattern-even) 11%,
  1042. var(--pattern-odd) 11%,
  1043. var(--pattern-odd) 21%,
  1044. var(--pattern-even) 21%,
  1045. var(--pattern-even) 31%,
  1046. var(--pattern-odd) 31%,
  1047. var(--pattern-odd) 41%,
  1048. var(--pattern-even) 41%,
  1049. var(--pattern-even) 51%,
  1050. var(--pattern-odd) 51%,
  1051. var(--pattern-odd) 61%,
  1052. var(--pattern-even) 61%,
  1053. var(--pattern-even) 71%,
  1054. var(--pattern-odd) 71%,
  1055. var(--pattern-odd) 81%,
  1056. var(--pattern-even) 81%,
  1057. var(--pattern-even) 91%,
  1058. var(--pattern-odd) 91%,
  1059. var(--pattern-odd) 101%
  1060. );
  1061. background-size: 25.5px 17px;
  1062. }
  1063. .TracePerformanceIssue {
  1064. position: absolute;
  1065. top: 0;
  1066. display: flex;
  1067. align-items: center;
  1068. justify-content: flex-start;
  1069. background-color: var(--performance-issue);
  1070. height: 16px;
  1071. }
  1072. .TraceRightColumn.Odd {
  1073. background-color: var(--row-background-odd);
  1074. }
  1075. &:hover {
  1076. background-color: var(--row-background-hovered);
  1077. }
  1078. &.Highlight {
  1079. box-shadow: inset 0 0 0 1px ${p => p.theme.blue200} !important;
  1080. .TraceLeftColumn {
  1081. box-shadow: inset 0px 0 0px 1px ${p => p.theme.blue200} !important;
  1082. }
  1083. }
  1084. &.Highlight,
  1085. &:focus,
  1086. &[tabindex='0'] {
  1087. outline: none;
  1088. background-color: var(--row-background-focused);
  1089. .TraceRightColumn.Odd {
  1090. background-color: transparent !important;
  1091. }
  1092. }
  1093. &:focus,
  1094. &[tabindex='0'] {
  1095. background-color: var(--row-background-focused);
  1096. box-shadow: inset 0 0 0 1px var(--row-outline) !important;
  1097. .TraceLeftColumn {
  1098. box-shadow: inset 0px 0 0px 1px var(--row-outline) !important;
  1099. }
  1100. .TraceRightColumn.Odd {
  1101. background-color: transparent !important;
  1102. }
  1103. }
  1104. &.SearchResult {
  1105. background-color: ${p => p.theme.yellow100};
  1106. .TraceRightColumn {
  1107. background-color: transparent;
  1108. }
  1109. }
  1110. &.Autogrouped {
  1111. color: ${p => p.theme.blue300};
  1112. .TraceDescription {
  1113. font-weight: ${p => p.theme.fontWeightBold};
  1114. }
  1115. .TraceChildrenCountWrapper {
  1116. button {
  1117. color: ${p => p.theme.white};
  1118. background-color: ${p => p.theme.blue300};
  1119. }
  1120. svg {
  1121. fill: ${p => p.theme.white};
  1122. }
  1123. }
  1124. &.error {
  1125. color: ${p => p.theme.red300};
  1126. .TraceChildrenCountWrapper {
  1127. button {
  1128. color: ${p => p.theme.white};
  1129. background-color: ${p => p.theme.red300};
  1130. }
  1131. }
  1132. }
  1133. }
  1134. &.Collapsed {
  1135. background-color: ${p => p.theme.backgroundSecondary};
  1136. border-bottom: 1px solid ${p => p.theme.border};
  1137. border-top: 1px solid ${p => p.theme.border};
  1138. .TraceLeftColumn {
  1139. padding-left: 14px;
  1140. width: 100%;
  1141. color: ${p => p.theme.subText};
  1142. .TraceLeftColumnInner {
  1143. padding-left: 0 !important;
  1144. }
  1145. }
  1146. }
  1147. }
  1148. .TraceLeftColumn {
  1149. height: 100%;
  1150. white-space: nowrap;
  1151. display: flex;
  1152. align-items: center;
  1153. overflow: hidden;
  1154. will-change: width;
  1155. box-shadow: inset 1px 0 0px 0px transparent;
  1156. cursor: pointer;
  1157. width: calc(var(--list-column-width) * 100%);
  1158. .TraceLeftColumnInner {
  1159. height: 100%;
  1160. white-space: nowrap;
  1161. display: flex;
  1162. align-items: center;
  1163. will-change: transform;
  1164. transform-origin: left center;
  1165. padding-right: ${space(2)};
  1166. img {
  1167. width: 16px;
  1168. height: 16px;
  1169. }
  1170. }
  1171. }
  1172. .TraceRightColumn {
  1173. height: 100%;
  1174. overflow: hidden;
  1175. position: relative;
  1176. display: flex;
  1177. align-items: center;
  1178. will-change: width;
  1179. z-index: 1;
  1180. cursor: pointer;
  1181. width: calc(var(--span-column-width) * 100%);
  1182. &:hover {
  1183. .TraceArrow.Visible {
  1184. opacity: 1;
  1185. transition: 300ms 300ms ease-out;
  1186. pointer-events: auto;
  1187. }
  1188. }
  1189. }
  1190. .TraceBar {
  1191. position: absolute;
  1192. height: 16px;
  1193. width: 100%;
  1194. background-color: black;
  1195. transform-origin: left center;
  1196. &.Invisible {
  1197. background-color: transparent !important;
  1198. > div {
  1199. height: 100%;
  1200. }
  1201. }
  1202. svg {
  1203. width: 14px;
  1204. height: 14px;
  1205. }
  1206. }
  1207. .TraceArrow {
  1208. position: absolute;
  1209. pointer-events: none;
  1210. top: 0;
  1211. width: 14px;
  1212. height: 24px;
  1213. opacity: 0;
  1214. background-color: transparent;
  1215. border: none;
  1216. transition: 60ms ease-out;
  1217. font-size: ${p => p.theme.fontSizeMedium};
  1218. color: ${p => p.theme.subText};
  1219. padding: 0 2px;
  1220. display: flex;
  1221. align-items: center;
  1222. svg {
  1223. fill: ${p => p.theme.subText};
  1224. }
  1225. &.Left {
  1226. left: 0;
  1227. }
  1228. &.Right {
  1229. right: 0;
  1230. transform: rotate(180deg);
  1231. }
  1232. }
  1233. .TraceBarDuration {
  1234. display: inline-block;
  1235. transform-origin: left center;
  1236. font-size: ${p => p.theme.fontSizeExtraSmall};
  1237. color: ${p => p.theme.gray300};
  1238. white-space: nowrap;
  1239. font-variant-numeric: tabular-nums;
  1240. position: absolute;
  1241. }
  1242. .TraceChildrenCount {
  1243. height: 16px;
  1244. white-space: nowrap;
  1245. min-width: 30px;
  1246. display: flex;
  1247. align-items: center;
  1248. justify-content: center;
  1249. border-radius: 99px;
  1250. padding: 0px 4px;
  1251. transition: all 0.15s ease-in-out;
  1252. background: ${p => p.theme.background};
  1253. border: 1.5px solid var(--row-children-button-border-color);
  1254. line-height: 0;
  1255. z-index: 1;
  1256. font-size: 10px;
  1257. box-shadow: ${p => p.theme.dropShadowLight};
  1258. margin-right: 8px;
  1259. .TraceChildrenCountContent {
  1260. + .TraceChildrenCountAction {
  1261. margin-left: 2px;
  1262. }
  1263. }
  1264. .TraceChildrenCountAction {
  1265. position: relative;
  1266. display: flex;
  1267. align-items: center;
  1268. justify-content: center;
  1269. }
  1270. .TraceActionsLoadingIndicator {
  1271. margin: 0;
  1272. position: absolute;
  1273. top: 50%;
  1274. left: 50%;
  1275. transform: translate(-50%, -50%);
  1276. background-color: ${p => p.theme.background};
  1277. animation: show 0.1s ease-in-out forwards;
  1278. @keyframes show {
  1279. from {
  1280. opacity: 0;
  1281. transform: translate(-50%, -50%) scale(0.86);
  1282. }
  1283. to {
  1284. opacity: 1;
  1285. transform: translate(-50%, -50%) scale(1);
  1286. }
  1287. }
  1288. .loading-indicator {
  1289. border-width: 2px;
  1290. }
  1291. .loading-message {
  1292. display: none;
  1293. }
  1294. }
  1295. svg {
  1296. width: 7px;
  1297. transition: none;
  1298. }
  1299. }
  1300. .TraceChildrenCountWrapper {
  1301. display: flex;
  1302. justify-content: flex-end;
  1303. align-items: center;
  1304. min-width: 44px;
  1305. height: 100%;
  1306. position: relative;
  1307. button {
  1308. transition: none;
  1309. }
  1310. svg {
  1311. fill: currentColor;
  1312. }
  1313. &.Orphaned {
  1314. .TraceVerticalConnector,
  1315. .TraceVerticalLastChildConnector,
  1316. .TraceExpandedVerticalConnector {
  1317. border-left: 2px dashed ${p => p.theme.border};
  1318. }
  1319. &::before {
  1320. border-bottom: 2px dashed ${p => p.theme.border};
  1321. }
  1322. }
  1323. &.Root {
  1324. &:before,
  1325. .TraceVerticalLastChildConnector {
  1326. visibility: hidden;
  1327. }
  1328. }
  1329. &::before {
  1330. content: '';
  1331. display: block;
  1332. width: 50%;
  1333. height: 2px;
  1334. border-bottom: 2px solid ${p => p.theme.border};
  1335. position: absolute;
  1336. left: 0;
  1337. top: 50%;
  1338. transform: translateY(-50%);
  1339. }
  1340. &::after {
  1341. content: '';
  1342. background-color: ${p => p.theme.border};
  1343. border-radius: 50%;
  1344. height: 6px;
  1345. width: 6px;
  1346. position: absolute;
  1347. left: 50%;
  1348. top: 50%;
  1349. transform: translateY(-50%);
  1350. }
  1351. }
  1352. .TraceVerticalConnector {
  1353. position: absolute;
  1354. left: 0;
  1355. top: 0;
  1356. bottom: 0;
  1357. height: 100%;
  1358. width: 2px;
  1359. border-left: 2px solid ${p => p.theme.border};
  1360. &.Orphaned {
  1361. border-left: 2px dashed ${p => p.theme.border};
  1362. }
  1363. }
  1364. .TraceVerticalLastChildConnector {
  1365. position: absolute;
  1366. left: 0;
  1367. top: 0;
  1368. bottom: 0;
  1369. height: 50%;
  1370. width: 2px;
  1371. border-left: 2px solid ${p => p.theme.border};
  1372. border-bottom-left-radius: 4px;
  1373. }
  1374. .TraceExpandedVerticalConnector {
  1375. position: absolute;
  1376. bottom: 0;
  1377. height: 50%;
  1378. left: 50%;
  1379. width: 2px;
  1380. border-left: 2px solid ${p => p.theme.border};
  1381. }
  1382. .TraceOperation {
  1383. margin-left: 4px;
  1384. text-overflow: ellipsis;
  1385. white-space: nowrap;
  1386. font-weight: ${p => p.theme.fontWeightBold};
  1387. }
  1388. .TraceEmDash {
  1389. margin-left: 4px;
  1390. margin-right: 4px;
  1391. }
  1392. .TraceDescription {
  1393. white-space: nowrap;
  1394. }
  1395. `;