trace.tsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  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 {TraceErrorRow} from './traceRow/traceErrorRow';
  33. import {TraceLoadingRow} from './traceRow/traceLoadingRow';
  34. import {TraceMissingInstrumentationRow} from './traceRow/traceMissingInstrumentationRow';
  35. import {TraceRootRow} from './traceRow/traceRootNode';
  36. import {
  37. TRACE_CHILDREN_COUNT_WRAPPER_CLASSNAME,
  38. TRACE_CHILDREN_COUNT_WRAPPER_ORPHANED_CLASSNAME,
  39. TRACE_RIGHT_COLUMN_EVEN_CLASSNAME,
  40. TRACE_RIGHT_COLUMN_ODD_CLASSNAME,
  41. type TraceRowProps,
  42. } from './traceRow/traceRow';
  43. import {TraceSpanRow} from './traceRow/traceSpanRow';
  44. import {TraceTransactionRow} from './traceRow/traceTransactionRow';
  45. import {
  46. getRovingIndexActionFromDOMEvent,
  47. type RovingTabIndexUserActions,
  48. } from './traceState/traceRovingTabIndex';
  49. import {useTraceState, useTraceStateDispatch} from './traceState/traceStateProvider';
  50. import {
  51. isAutogroupedNode,
  52. isMissingInstrumentationNode,
  53. isSpanNode,
  54. isTraceErrorNode,
  55. isTraceNode,
  56. isTransactionNode,
  57. } from './traceGuards';
  58. import type {TraceReducerState} from './traceState';
  59. function computeNextIndexFromAction(
  60. current_index: number,
  61. action: RovingTabIndexUserActions,
  62. items: number
  63. ): number {
  64. switch (action) {
  65. case 'next':
  66. if (current_index === items) {
  67. return 0;
  68. }
  69. return current_index + 1;
  70. case 'previous':
  71. if (current_index === 0) {
  72. return items;
  73. }
  74. return current_index - 1;
  75. case 'last':
  76. return items;
  77. case 'first':
  78. return 0;
  79. default:
  80. throw new TypeError(`Invalid or not implemented reducer action - ${action}`);
  81. }
  82. }
  83. interface TraceProps {
  84. forceRerender: number;
  85. isEmbedded: boolean;
  86. isLoading: boolean;
  87. manager: VirtualizedViewManager;
  88. onRowClick: (
  89. node: TraceTreeNode<TraceTree.NodeValue>,
  90. event: React.MouseEvent<HTMLElement>,
  91. index: number
  92. ) => void;
  93. onTraceSearch: (
  94. query: string,
  95. node: TraceTreeNode<TraceTree.NodeValue>,
  96. behavior: 'track result' | 'persist'
  97. ) => void;
  98. previouslyFocusedNodeRef: React.MutableRefObject<TraceTreeNode<TraceTree.NodeValue> | null>;
  99. rerender: () => void;
  100. scheduler: TraceScheduler;
  101. trace: TraceTree;
  102. trace_id: string | undefined;
  103. }
  104. export function Trace({
  105. trace,
  106. onRowClick,
  107. manager,
  108. previouslyFocusedNodeRef,
  109. onTraceSearch,
  110. rerender,
  111. scheduler,
  112. forceRerender,
  113. trace_id,
  114. isEmbedded,
  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. isEmbedded={isEmbedded}
  309. />
  310. );
  311. },
  312. // we add forceRerender as a "unnecessary" dependency to trigger the virtualized list rerender
  313. // eslint-disable-next-line react-hooks/exhaustive-deps
  314. [
  315. onNodeExpand,
  316. onNodeZoomIn,
  317. manager,
  318. previouslyFocusedNodeRef,
  319. onRowKeyDown,
  320. onRowClick,
  321. organization,
  322. projectLookup,
  323. traceState.rovingTabIndex.node,
  324. traceState.search.resultIteratorIndex,
  325. traceState.search.resultsLookup,
  326. traceState.search.resultIndex,
  327. theme,
  328. trace.type,
  329. forceRerender,
  330. ]
  331. );
  332. const render = useMemo(() => {
  333. return trace.type !== 'trace' || isLoading
  334. ? r => renderLoadingRow(r)
  335. : r => renderVirtualizedRow(r);
  336. }, [isLoading, renderLoadingRow, renderVirtualizedRow, trace.type]);
  337. const traceNode = trace.root.children[0];
  338. const traceStartTimestamp = traceNode?.space?.[0];
  339. const [scrollContainer, setScrollContainer] = useState<HTMLElement | null>(null);
  340. const virtualizedList = useVirtualizedList({
  341. manager,
  342. items: trace.list,
  343. container: scrollContainer,
  344. render: render,
  345. scheduler,
  346. });
  347. return (
  348. <TraceStylingWrapper
  349. ref={manager.registerContainerRef}
  350. className={`
  351. ${trace.root.space[1] === 0 ? 'Empty' : ''}
  352. ${trace.indicators.length > 0 ? 'WithIndicators' : ''}
  353. ${trace.type !== 'trace' || isLoading ? 'Loading' : ''}
  354. ${ConfigStore.get('theme')}`}
  355. >
  356. <div
  357. className="TraceScrollbarContainer"
  358. ref={manager.registerHorizontalScrollBarContainerRef}
  359. >
  360. <div className="TraceScrollbarScroller" />
  361. </div>
  362. <div className="TraceDivider" ref={manager.registerDividerRef} />
  363. <div
  364. className="TraceIndicatorContainer"
  365. ref={manager.registerIndicatorContainerRef}
  366. >
  367. {trace.indicators.length > 0
  368. ? trace.indicators.map((indicator, i) => {
  369. return (
  370. <div
  371. key={i}
  372. ref={r => manager.registerIndicatorRef(r, i, indicator)}
  373. className={`TraceIndicator ${indicator.poor ? 'Errored' : ''}`}
  374. >
  375. <div className="TraceIndicatorLabel">{indicator.label}</div>
  376. <div className="TraceIndicatorLine" />
  377. </div>
  378. );
  379. })
  380. : null}
  381. {manager.interval_bars.map((_, i) => {
  382. const indicatorTimestamp = manager.intervals[i] ?? 0;
  383. if (trace.type !== 'trace' || isLoading) {
  384. return null;
  385. }
  386. return (
  387. <div
  388. key={i}
  389. ref={r => manager.registerTimelineIndicatorRef(r, i)}
  390. className="TraceIndicator Timeline"
  391. >
  392. <div className="TraceIndicatorLabel">
  393. {indicatorTimestamp > 0
  394. ? formatTraceDuration(manager.view.trace_view.x + indicatorTimestamp)
  395. : '0s'}
  396. </div>
  397. <div className="TraceIndicatorLine" />
  398. </div>
  399. );
  400. })}
  401. {traceNode && traceStartTimestamp ? (
  402. <VerticalTimestampIndicators
  403. viewmanager={manager}
  404. traceStartTimestamp={traceStartTimestamp}
  405. />
  406. ) : null}
  407. </div>
  408. <div
  409. ref={setScrollContainer}
  410. data-test-id="trace-virtualized-list-scroll-container"
  411. >
  412. <div data-test-id="trace-virtualized-list">{virtualizedList.rendered}</div>
  413. <div className="TraceRow Hidden">
  414. <div
  415. className="TraceLeftColumn"
  416. ref={r => manager.registerGhostRowRef('list', r)}
  417. />
  418. <div
  419. className="TraceRightColumn"
  420. ref={r => manager.registerGhostRowRef('span_list', r)}
  421. />
  422. </div>
  423. </div>
  424. </TraceStylingWrapper>
  425. );
  426. }
  427. function RenderTraceRow(props: {
  428. index: number;
  429. isEmbedded: boolean;
  430. isSearchResult: boolean;
  431. manager: VirtualizedViewManager;
  432. node: TraceTreeNode<TraceTree.NodeValue>;
  433. onExpand: (
  434. event: React.MouseEvent<Element>,
  435. node: TraceTreeNode<TraceTree.NodeValue>,
  436. value: boolean
  437. ) => void;
  438. onRowClick: (
  439. node: TraceTreeNode<TraceTree.NodeValue>,
  440. event: React.MouseEvent<HTMLElement>,
  441. index: number
  442. ) => void;
  443. onRowKeyDown: (
  444. event: React.KeyboardEvent,
  445. index: number,
  446. node: TraceTreeNode<TraceTree.NodeValue>
  447. ) => void;
  448. onZoomIn: (
  449. event: React.MouseEvent<Element>,
  450. node: TraceTreeNode<TraceTree.NodeValue>,
  451. value: boolean
  452. ) => void;
  453. organization: Organization;
  454. previouslyFocusedNodeRef: React.MutableRefObject<TraceTreeNode<TraceTree.NodeValue> | null>;
  455. projects: Record<Project['slug'], Project['platform']>;
  456. searchResultsIteratorIndex: number | null;
  457. style: React.CSSProperties;
  458. tabIndex: number;
  459. theme: Theme;
  460. trace_id: string | undefined;
  461. tree: TraceTree;
  462. }) {
  463. const node = props.node;
  464. const virtualized_index = props.index - props.manager.start_virtualized_index;
  465. const rowSearchClassName = `${props.isSearchResult ? 'SearchResult' : ''} ${props.searchResultsIteratorIndex === props.index ? 'Highlight' : ''}`;
  466. const registerListColumnRef = useCallback(
  467. (ref: HTMLDivElement | null) => {
  468. props.manager.registerColumnRef('list', ref, virtualized_index, node);
  469. },
  470. [props.manager, node, virtualized_index]
  471. );
  472. const registerSpanColumnRef = useCallback(
  473. (ref: HTMLDivElement | null) => {
  474. props.manager.registerColumnRef('span_list', ref, virtualized_index, node);
  475. },
  476. [props.manager, node, virtualized_index]
  477. );
  478. const registerSpanArrowRef = useCallback(
  479. ref => {
  480. props.manager.registerArrowRef(ref, node.space!, virtualized_index);
  481. },
  482. [props.manager, node, virtualized_index]
  483. );
  484. const onRowClickProp = props.onRowClick;
  485. const onRowClick = useCallback(
  486. (event: React.MouseEvent<HTMLElement>) => {
  487. onRowClickProp(node, event, props.index);
  488. },
  489. [props.index, node, onRowClickProp]
  490. );
  491. const onRowKeyDownProp = props.onRowKeyDown;
  492. const onRowKeyDown = useCallback(
  493. (event: React.KeyboardEvent) => onRowKeyDownProp(event, props.index, node),
  494. [props.index, node, onRowKeyDownProp]
  495. );
  496. const onRowDoubleClick = useCallback(
  497. (e: React.MouseEvent) => {
  498. trackAnalytics('trace.trace_layout.zoom_to_fill', {
  499. organization: props.organization,
  500. });
  501. e.stopPropagation();
  502. props.manager.onZoomIntoSpace(node.space!);
  503. },
  504. [node, props.manager, props.organization]
  505. );
  506. const onSpanRowArrowClick = useCallback(
  507. (_e: React.MouseEvent) => {
  508. props.manager.onBringRowIntoView(node.space!);
  509. },
  510. [node.space, props.manager]
  511. );
  512. const onExpandProp = props.onExpand;
  513. const onExpand = useCallback(
  514. (e: React.MouseEvent) => {
  515. onExpandProp(e, node, !node.expanded);
  516. },
  517. [node, onExpandProp]
  518. );
  519. const onZoomInProp = props.onZoomIn;
  520. const onZoomIn = useCallback(
  521. (e: React.MouseEvent) => {
  522. onZoomInProp(e, node, !node.zoomedIn);
  523. },
  524. [node, onZoomInProp]
  525. );
  526. const onExpandDoubleClick = useCallback((e: React.MouseEvent) => {
  527. e.stopPropagation();
  528. }, []);
  529. const spanColumnClassName =
  530. props.index % 2 === 1
  531. ? TRACE_RIGHT_COLUMN_ODD_CLASSNAME
  532. : TRACE_RIGHT_COLUMN_EVEN_CLASSNAME;
  533. const listColumnClassName = isTraceNode(node)
  534. ? TRACE_CHILDREN_COUNT_WRAPPER_ORPHANED_CLASSNAME
  535. : TRACE_CHILDREN_COUNT_WRAPPER_CLASSNAME;
  536. const listColumnStyle: React.CSSProperties = {
  537. paddingLeft: TraceTree.Depth(node) * props.manager.row_depth_padding,
  538. };
  539. const rowProps: TraceRowProps<TraceTreeNode<TraceTree.NodeValue>> = {
  540. onExpand,
  541. onZoomIn,
  542. onRowClick,
  543. onRowKeyDown,
  544. previouslyFocusedNodeRef: props.previouslyFocusedNodeRef,
  545. isEmbedded: props.isEmbedded,
  546. onSpanArrowClick: onSpanRowArrowClick,
  547. manager: props.manager,
  548. index: props.index,
  549. theme: props.theme,
  550. style: props.style,
  551. projects: props.projects,
  552. tabIndex: props.tabIndex,
  553. onRowDoubleClick,
  554. trace_id: props.trace_id,
  555. node: props.node,
  556. virtualized_index,
  557. listColumnStyle,
  558. listColumnClassName,
  559. spanColumnClassName,
  560. onExpandDoubleClick,
  561. rowSearchClassName,
  562. registerListColumnRef,
  563. registerSpanColumnRef,
  564. registerSpanArrowRef,
  565. };
  566. if (isTransactionNode(node)) {
  567. return <TraceTransactionRow {...rowProps} node={node} />;
  568. }
  569. if (isSpanNode(node)) {
  570. return <TraceSpanRow {...rowProps} node={node} />;
  571. }
  572. if (isMissingInstrumentationNode(node)) {
  573. return <TraceMissingInstrumentationRow {...rowProps} node={node} />;
  574. }
  575. if (isAutogroupedNode(node)) {
  576. return <TraceAutogroupedRow {...rowProps} node={node} />;
  577. }
  578. if (isTraceErrorNode(node)) {
  579. return <TraceErrorRow {...rowProps} node={node} />;
  580. }
  581. if (isTraceNode(node)) {
  582. return <TraceRootRow {...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. --info: ${p => p.theme.purple400};
  669. --warning: ${p => p.theme.yellow300};
  670. --debug: ${p => p.theme.blue300};
  671. --error: ${p => p.theme.error};
  672. --fatal: ${p => p.theme.error};
  673. --default: ${p => p.theme.gray300};
  674. --unknown: ${p => p.theme.gray300};
  675. --profile: ${p => p.theme.purple300};
  676. --autogrouped: ${p => p.theme.blue300};
  677. --performance-issue: ${p => p.theme.blue300};
  678. &.WithIndicators {
  679. padding-top: 44px;
  680. &:before {
  681. height: 44px;
  682. .TraceScrollbarContainer {
  683. height: 44px;
  684. }
  685. }
  686. .TraceIndicator.Timeline {
  687. .TraceIndicatorLabel {
  688. top: 26px;
  689. }
  690. .TraceIndicatorLine {
  691. top: 30px;
  692. }
  693. .Indicator {
  694. top: 44px;
  695. }
  696. }
  697. }
  698. &:before {
  699. content: '';
  700. position: absolute;
  701. left: 0;
  702. top: 0;
  703. width: 100%;
  704. height: 26px;
  705. background-color: ${p => p.theme.backgroundSecondary};
  706. border-bottom: 1px solid ${p => p.theme.border};
  707. }
  708. &.Loading {
  709. .TraceRow {
  710. .TraceLeftColumnInner {
  711. width: 100%;
  712. }
  713. }
  714. .TraceRightColumn {
  715. background-color: transparent !important;
  716. }
  717. .TraceDivider {
  718. pointer-events: none;
  719. }
  720. }
  721. &.Empty {
  722. .TraceIcon {
  723. left: 50%;
  724. }
  725. }
  726. .TraceScrollbarContainer {
  727. left: 0;
  728. top: 0;
  729. height: 26px;
  730. position: absolute;
  731. overflow-x: auto;
  732. overscroll-behavior: none;
  733. will-change: transform;
  734. .TraceScrollbarScroller {
  735. height: 1px;
  736. pointer-events: none;
  737. visibility: hidden;
  738. }
  739. .TraceScrollbarHandle {
  740. width: 24px;
  741. height: 12px;
  742. border-radius: 6px;
  743. }
  744. }
  745. .TraceDivider {
  746. position: absolute;
  747. height: 100%;
  748. background-color: transparent;
  749. top: 0;
  750. cursor: ew-resize;
  751. z-index: 10;
  752. &:before {
  753. content: '';
  754. position: absolute;
  755. width: 1px;
  756. height: 100%;
  757. background-color: ${p => p.theme.border};
  758. left: 50%;
  759. }
  760. &:hover {
  761. &:before {
  762. background-color: ${p => p.theme.purple300};
  763. }
  764. }
  765. }
  766. .TraceIndicatorContainer {
  767. overflow: hidden;
  768. width: 100%;
  769. height: 100%;
  770. position: absolute;
  771. right: 0;
  772. top: 0;
  773. z-index: 10;
  774. pointer-events: none;
  775. }
  776. .TraceIndicator {
  777. z-index: 1;
  778. width: 3px;
  779. height: 100%;
  780. top: 0;
  781. position: absolute;
  782. &:hover {
  783. z-index: 10;
  784. }
  785. .TraceIndicatorLabel {
  786. min-width: 34px;
  787. text-align: center;
  788. position: absolute;
  789. font-size: 10px;
  790. font-weight: ${p => p.theme.fontWeightBold};
  791. color: ${p => p.theme.textColor};
  792. background-color: ${p => p.theme.background};
  793. border-radius: ${p => p.theme.borderRadius};
  794. border: 1px solid ${p => p.theme.border};
  795. padding: 2px;
  796. display: inline-block;
  797. line-height: 1;
  798. margin-top: 2px;
  799. white-space: nowrap;
  800. }
  801. .TraceIndicatorLine {
  802. width: 1px;
  803. height: 100%;
  804. top: 20px;
  805. position: absolute;
  806. left: 50%;
  807. transform: translateX(-2px);
  808. background: repeating-linear-gradient(
  809. to bottom,
  810. transparent 0 4px,
  811. ${p => p.theme.textColor} 4px 8px
  812. )
  813. 80%/2px 100% no-repeat;
  814. }
  815. .Indicator {
  816. width: 1px;
  817. height: 100%;
  818. position: absolute;
  819. left: 50%;
  820. transform: translateX(-2px);
  821. top: 26px;
  822. &.CurrentReplayTimestamp {
  823. background: ${p => p.theme.purple300};
  824. }
  825. &.HoverReplayTimestamp {
  826. background: ${p => p.theme.purple200};
  827. }
  828. }
  829. &.Errored {
  830. .TraceIndicatorLabel {
  831. border: 1px solid ${p => p.theme.error};
  832. color: ${p => p.theme.error};
  833. }
  834. .TraceIndicatorLine {
  835. background: repeating-linear-gradient(
  836. to bottom,
  837. transparent 0 4px,
  838. ${p => p.theme.error} 4px 8px
  839. )
  840. 80%/2px 100% no-repeat;
  841. }
  842. }
  843. &.Timeline {
  844. opacity: 1;
  845. z-index: 1;
  846. pointer-events: none;
  847. .TraceIndicatorLabel {
  848. font-weight: ${p => p.theme.fontWeightNormal};
  849. min-width: 0;
  850. top: 8px;
  851. width: auto;
  852. border: none;
  853. background-color: transparent;
  854. color: ${p => p.theme.subText};
  855. }
  856. .TraceIndicatorLine {
  857. background: ${p => p.theme.translucentGray100};
  858. top: 8px;
  859. }
  860. }
  861. }
  862. &.light {
  863. .TracePattern {
  864. &.info {
  865. --pattern-odd: #d1dff9;
  866. --pattern-even: ${p => p.theme.blue300};
  867. }
  868. &.warning {
  869. --pattern-odd: #a5752c;
  870. --pattern-even: ${p => p.theme.yellow300};
  871. }
  872. &.performance_issue {
  873. --pattern-odd: #063690;
  874. --pattern-even: ${p => p.theme.blue300};
  875. }
  876. &.profile {
  877. --pattern-odd: rgba(58, 17, 95, 0.55);
  878. --pattern-even: transparent;
  879. }
  880. &.missing_instrumentation {
  881. --pattern-odd: #dedae3;
  882. --pattern-even: #f4f2f7;
  883. }
  884. &.error,
  885. &.fatal {
  886. --pattern-odd: #872d32;
  887. --pattern-even: ${p => p.theme.red300};
  888. }
  889. /* false positive for grid layout */
  890. /* stylelint-disable */
  891. &.default {
  892. }
  893. &.unknown {
  894. }
  895. /* stylelint-enable */
  896. }
  897. }
  898. &.dark {
  899. .TracePattern {
  900. &.info {
  901. --pattern-odd: #d1dff9;
  902. --pattern-even: ${p => p.theme.blue300};
  903. }
  904. &.warning {
  905. --pattern-odd: #a5752c;
  906. --pattern-even: ${p => p.theme.yellow300};
  907. }
  908. &.performance_issue {
  909. --pattern-odd: #063690;
  910. --pattern-even: ${p => p.theme.blue300};
  911. }
  912. &.profile {
  913. --pattern-odd: rgba(58, 17, 95, 0.55);
  914. --pattern-even: transparent;
  915. }
  916. &.missing_instrumentation {
  917. --pattern-odd: #4b4550;
  918. --pattern-even: #1c1521;
  919. }
  920. &.error,
  921. &.fatal {
  922. --pattern-odd: #510d10;
  923. --pattern-even: ${p => p.theme.red300};
  924. }
  925. /* stylelint-disable */
  926. &.default {
  927. }
  928. &.unknown {
  929. }
  930. /* stylelint-enable */
  931. }
  932. }
  933. .TraceRow {
  934. display: flex;
  935. align-items: center;
  936. position: absolute;
  937. height: 24px;
  938. width: 100%;
  939. transition: none;
  940. font-size: ${p => p.theme.fontSizeSmall};
  941. transform: translateZ(0);
  942. --row-background-odd: ${p => p.theme.translucentSurface100};
  943. --row-background-hover: ${p => p.theme.translucentSurface100};
  944. --row-background-focused: ${p => p.theme.translucentSurface200};
  945. --row-outline: ${p => p.theme.blue300};
  946. --row-children-button-border-color: ${p => p.theme.border};
  947. /* allow empty blocks so we can keep an exhaustive list of classnames for future reference */
  948. /* stylelint-disable */
  949. &.info {
  950. }
  951. &.warning {
  952. }
  953. &.debug {
  954. }
  955. &.error,
  956. &.fatal,
  957. &.performance_issue {
  958. color: ${p => p.theme.errorText};
  959. --autogrouped: ${p => p.theme.error};
  960. --row-children-button-border-color: ${p => p.theme.error};
  961. --row-outline: ${p => p.theme.error};
  962. }
  963. &.default {
  964. }
  965. &.unknown {
  966. }
  967. &.Hidden {
  968. position: absolute;
  969. height: 100%;
  970. width: 100%;
  971. top: 0;
  972. z-index: -1;
  973. &:hover {
  974. background-color: transparent;
  975. }
  976. * {
  977. cursor: default !important;
  978. }
  979. }
  980. .TraceIcon {
  981. position: absolute;
  982. top: 50%;
  983. transform: translate(-50%, -50%) scaleX(var(--inverse-span-scale)) translateZ(0);
  984. background-color: ${p => p.theme.background};
  985. width: 18px !important;
  986. height: 18px !important;
  987. border-radius: 50%;
  988. display: flex;
  989. align-items: center;
  990. justify-content: center;
  991. z-index: 1;
  992. &.info {
  993. background-color: var(--info);
  994. }
  995. &.warning {
  996. background-color: var(--warning);
  997. }
  998. &.debug {
  999. background-color: var(--debug);
  1000. }
  1001. &.error,
  1002. &.fatal {
  1003. background-color: var(--error);
  1004. }
  1005. &.performance_issue {
  1006. background-color: var(--performance-issue);
  1007. }
  1008. &.default {
  1009. background-color: var(--default);
  1010. }
  1011. &.unknown {
  1012. background-color: var(--unknown);
  1013. }
  1014. &.profile {
  1015. background-color: var(--profile);
  1016. }
  1017. svg {
  1018. width: 12px;
  1019. height: 12px;
  1020. fill: ${p => p.theme.white};
  1021. }
  1022. &.profile svg {
  1023. margin-left: 2px;
  1024. }
  1025. &.info,
  1026. &.warning,
  1027. &.performance_issue,
  1028. &.default,
  1029. &.unknown {
  1030. svg {
  1031. transform: translateY(-1px);
  1032. }
  1033. }
  1034. }
  1035. .TracePatternContainer {
  1036. position: absolute;
  1037. width: 100%;
  1038. height: 100%;
  1039. overflow: hidden;
  1040. }
  1041. .TracePattern {
  1042. left: 0;
  1043. width: 1000000px;
  1044. height: 100%;
  1045. position: absolute;
  1046. transform-origin: left center;
  1047. transform: scaleX(var(--inverse-span-scale)) translateZ(0);
  1048. background-image: linear-gradient(
  1049. 135deg,
  1050. var(--pattern-even) 1%,
  1051. var(--pattern-even) 11%,
  1052. var(--pattern-odd) 11%,
  1053. var(--pattern-odd) 21%,
  1054. var(--pattern-even) 21%,
  1055. var(--pattern-even) 31%,
  1056. var(--pattern-odd) 31%,
  1057. var(--pattern-odd) 41%,
  1058. var(--pattern-even) 41%,
  1059. var(--pattern-even) 51%,
  1060. var(--pattern-odd) 51%,
  1061. var(--pattern-odd) 61%,
  1062. var(--pattern-even) 61%,
  1063. var(--pattern-even) 71%,
  1064. var(--pattern-odd) 71%,
  1065. var(--pattern-odd) 81%,
  1066. var(--pattern-even) 81%,
  1067. var(--pattern-even) 91%,
  1068. var(--pattern-odd) 91%,
  1069. var(--pattern-odd) 101%
  1070. );
  1071. background-size: 25.5px 17px;
  1072. }
  1073. .TracePerformanceIssue {
  1074. position: absolute;
  1075. top: 0;
  1076. display: flex;
  1077. align-items: center;
  1078. justify-content: flex-start;
  1079. background-color: var(--performance-issue);
  1080. height: 16px;
  1081. }
  1082. .TraceRightColumn.Odd {
  1083. background-color: var(--row-background-odd);
  1084. }
  1085. &:hover {
  1086. background-color: var(--row-background-hovered);
  1087. }
  1088. &.Highlight {
  1089. box-shadow: inset 0 0 0 1px ${p => p.theme.blue200} !important;
  1090. .TraceLeftColumn {
  1091. box-shadow: inset 0px 0 0px 1px ${p => p.theme.blue200} !important;
  1092. }
  1093. }
  1094. &.Highlight,
  1095. &:focus,
  1096. &[tabindex='0'] {
  1097. outline: none;
  1098. background-color: var(--row-background-focused);
  1099. .TraceRightColumn.Odd {
  1100. background-color: transparent !important;
  1101. }
  1102. }
  1103. &:focus,
  1104. &[tabindex='0'] {
  1105. background-color: var(--row-background-focused);
  1106. box-shadow: inset 0 0 0 1px var(--row-outline) !important;
  1107. .TraceLeftColumn {
  1108. box-shadow: inset 0px 0 0px 1px var(--row-outline) !important;
  1109. }
  1110. .TraceRightColumn.Odd {
  1111. background-color: transparent !important;
  1112. }
  1113. }
  1114. &.SearchResult {
  1115. background-color: ${p => p.theme.yellow100};
  1116. .TraceRightColumn {
  1117. background-color: transparent;
  1118. }
  1119. }
  1120. &.Autogrouped {
  1121. color: ${p => p.theme.blue300};
  1122. .TraceDescription {
  1123. font-weight: ${p => p.theme.fontWeightBold};
  1124. }
  1125. .TraceChildrenCountWrapper {
  1126. button {
  1127. color: ${p => p.theme.white};
  1128. background-color: ${p => p.theme.blue300};
  1129. }
  1130. svg {
  1131. fill: ${p => p.theme.white};
  1132. }
  1133. }
  1134. &.error {
  1135. color: ${p => p.theme.red300};
  1136. .TraceChildrenCountWrapper {
  1137. button {
  1138. color: ${p => p.theme.white};
  1139. background-color: ${p => p.theme.red300};
  1140. }
  1141. }
  1142. }
  1143. }
  1144. }
  1145. .TraceLeftColumn {
  1146. height: 100%;
  1147. white-space: nowrap;
  1148. display: flex;
  1149. align-items: center;
  1150. overflow: hidden;
  1151. will-change: width;
  1152. box-shadow: inset 1px 0 0px 0px transparent;
  1153. cursor: pointer;
  1154. width: calc(var(--list-column-width) * 100%);
  1155. .TraceLeftColumnInner {
  1156. height: 100%;
  1157. white-space: nowrap;
  1158. display: flex;
  1159. align-items: center;
  1160. will-change: transform;
  1161. transform-origin: left center;
  1162. padding-right: ${space(2)};
  1163. img {
  1164. width: 16px;
  1165. height: 16px;
  1166. }
  1167. }
  1168. }
  1169. .TraceRightColumn {
  1170. height: 100%;
  1171. overflow: hidden;
  1172. position: relative;
  1173. display: flex;
  1174. align-items: center;
  1175. will-change: width;
  1176. z-index: 1;
  1177. cursor: pointer;
  1178. width: calc(var(--span-column-width) * 100%);
  1179. &:hover {
  1180. .TraceArrow.Visible {
  1181. opacity: 1;
  1182. transition: 300ms 300ms ease-out;
  1183. pointer-events: auto;
  1184. }
  1185. }
  1186. }
  1187. .TraceBar {
  1188. position: absolute;
  1189. height: 16px;
  1190. width: 100%;
  1191. background-color: black;
  1192. transform-origin: left center;
  1193. &.Invisible {
  1194. background-color: transparent !important;
  1195. > div {
  1196. height: 100%;
  1197. }
  1198. }
  1199. svg {
  1200. width: 14px;
  1201. height: 14px;
  1202. }
  1203. }
  1204. .TraceArrow {
  1205. position: absolute;
  1206. pointer-events: none;
  1207. top: 0;
  1208. width: 14px;
  1209. height: 24px;
  1210. opacity: 0;
  1211. background-color: transparent;
  1212. border: none;
  1213. transition: 60ms ease-out;
  1214. font-size: ${p => p.theme.fontSizeMedium};
  1215. color: ${p => p.theme.subText};
  1216. padding: 0 2px;
  1217. display: flex;
  1218. align-items: center;
  1219. svg {
  1220. fill: ${p => p.theme.subText};
  1221. }
  1222. &.Left {
  1223. left: 0;
  1224. }
  1225. &.Right {
  1226. right: 0;
  1227. transform: rotate(180deg);
  1228. }
  1229. }
  1230. .TraceBarDuration {
  1231. display: inline-block;
  1232. transform-origin: left center;
  1233. font-size: ${p => p.theme.fontSizeExtraSmall};
  1234. color: ${p => p.theme.gray300};
  1235. white-space: nowrap;
  1236. font-variant-numeric: tabular-nums;
  1237. position: absolute;
  1238. }
  1239. .TraceChildrenCount {
  1240. height: 16px;
  1241. white-space: nowrap;
  1242. min-width: 30px;
  1243. display: flex;
  1244. align-items: center;
  1245. justify-content: center;
  1246. border-radius: 99px;
  1247. padding: 0px 4px;
  1248. transition: all 0.15s ease-in-out;
  1249. background: ${p => p.theme.background};
  1250. border: 1.5px solid var(--row-children-button-border-color);
  1251. line-height: 0;
  1252. z-index: 1;
  1253. font-size: 10px;
  1254. box-shadow: ${p => p.theme.dropShadowLight};
  1255. margin-right: 8px;
  1256. .TraceChildrenCountContent {
  1257. + .TraceChildrenCountAction {
  1258. margin-left: 2px;
  1259. }
  1260. }
  1261. .TraceChildrenCountAction {
  1262. position: relative;
  1263. display: flex;
  1264. align-items: center;
  1265. justify-content: center;
  1266. }
  1267. .TraceActionsLoadingIndicator {
  1268. margin: 0;
  1269. position: absolute;
  1270. top: 50%;
  1271. left: 50%;
  1272. transform: translate(-50%, -50%);
  1273. background-color: ${p => p.theme.background};
  1274. animation: show 0.1s ease-in-out forwards;
  1275. @keyframes show {
  1276. from {
  1277. opacity: 0;
  1278. transform: translate(-50%, -50%) scale(0.86);
  1279. }
  1280. to {
  1281. opacity: 1;
  1282. transform: translate(-50%, -50%) scale(1);
  1283. }
  1284. }
  1285. .loading-indicator {
  1286. border-width: 2px;
  1287. }
  1288. .loading-message {
  1289. display: none;
  1290. }
  1291. }
  1292. svg {
  1293. width: 7px;
  1294. transition: none;
  1295. }
  1296. }
  1297. .TraceChildrenCountWrapper {
  1298. display: flex;
  1299. justify-content: flex-end;
  1300. align-items: center;
  1301. min-width: 44px;
  1302. height: 100%;
  1303. position: relative;
  1304. button {
  1305. transition: none;
  1306. }
  1307. svg {
  1308. fill: currentColor;
  1309. }
  1310. &.Orphaned {
  1311. .TraceVerticalConnector,
  1312. .TraceVerticalLastChildConnector,
  1313. .TraceExpandedVerticalConnector {
  1314. border-left: 2px dashed ${p => p.theme.border};
  1315. }
  1316. &::before {
  1317. border-bottom: 2px dashed ${p => p.theme.border};
  1318. }
  1319. }
  1320. &.Root {
  1321. &:before,
  1322. .TraceVerticalLastChildConnector {
  1323. visibility: hidden;
  1324. }
  1325. }
  1326. &::before {
  1327. content: '';
  1328. display: block;
  1329. width: 50%;
  1330. height: 2px;
  1331. border-bottom: 2px solid ${p => p.theme.border};
  1332. position: absolute;
  1333. left: 0;
  1334. top: 50%;
  1335. transform: translateY(-50%);
  1336. }
  1337. &::after {
  1338. content: '';
  1339. background-color: ${p => p.theme.border};
  1340. border-radius: 50%;
  1341. height: 6px;
  1342. width: 6px;
  1343. position: absolute;
  1344. left: 50%;
  1345. top: 50%;
  1346. transform: translateY(-50%);
  1347. }
  1348. }
  1349. .TraceVerticalConnector {
  1350. position: absolute;
  1351. left: 0;
  1352. top: 0;
  1353. bottom: 0;
  1354. height: 100%;
  1355. width: 2px;
  1356. border-left: 2px solid ${p => p.theme.border};
  1357. &.Orphaned {
  1358. border-left: 2px dashed ${p => p.theme.border};
  1359. }
  1360. }
  1361. .TraceVerticalLastChildConnector {
  1362. position: absolute;
  1363. left: 0;
  1364. top: 0;
  1365. bottom: 0;
  1366. height: 50%;
  1367. width: 2px;
  1368. border-left: 2px solid ${p => p.theme.border};
  1369. border-bottom-left-radius: 4px;
  1370. }
  1371. .TraceExpandedVerticalConnector {
  1372. position: absolute;
  1373. bottom: 0;
  1374. height: 50%;
  1375. left: 50%;
  1376. width: 2px;
  1377. border-left: 2px solid ${p => p.theme.border};
  1378. }
  1379. .TraceOperation {
  1380. margin-left: 4px;
  1381. text-overflow: ellipsis;
  1382. white-space: nowrap;
  1383. font-weight: ${p => p.theme.fontWeightBold};
  1384. }
  1385. .TraceEmDash {
  1386. margin-left: 4px;
  1387. margin-right: 4px;
  1388. }
  1389. .TraceDescription {
  1390. white-space: nowrap;
  1391. }
  1392. `;