trace.tsx 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  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. &.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. }
  1135. .TraceLeftColumn {
  1136. height: 100%;
  1137. white-space: nowrap;
  1138. display: flex;
  1139. align-items: center;
  1140. overflow: hidden;
  1141. will-change: width;
  1142. box-shadow: inset 1px 0 0px 0px transparent;
  1143. cursor: pointer;
  1144. width: calc(var(--list-column-width) * 100%);
  1145. .TraceLeftColumnInner {
  1146. height: 100%;
  1147. white-space: nowrap;
  1148. display: flex;
  1149. align-items: center;
  1150. will-change: transform;
  1151. transform-origin: left center;
  1152. padding-right: ${space(2)};
  1153. img {
  1154. width: 16px;
  1155. height: 16px;
  1156. }
  1157. }
  1158. }
  1159. .TraceRightColumn {
  1160. height: 100%;
  1161. overflow: hidden;
  1162. position: relative;
  1163. display: flex;
  1164. align-items: center;
  1165. will-change: width;
  1166. z-index: 1;
  1167. cursor: pointer;
  1168. width: calc(var(--span-column-width) * 100%);
  1169. &:hover {
  1170. .TraceArrow.Visible {
  1171. opacity: 1;
  1172. transition: 300ms 300ms ease-out;
  1173. pointer-events: auto;
  1174. }
  1175. }
  1176. }
  1177. .TraceBar {
  1178. position: absolute;
  1179. height: 16px;
  1180. width: 100%;
  1181. background-color: black;
  1182. transform-origin: left center;
  1183. &.Invisible {
  1184. background-color: transparent !important;
  1185. > div {
  1186. height: 100%;
  1187. }
  1188. }
  1189. svg {
  1190. width: 14px;
  1191. height: 14px;
  1192. }
  1193. }
  1194. .TraceArrow {
  1195. position: absolute;
  1196. pointer-events: none;
  1197. top: 0;
  1198. width: 14px;
  1199. height: 24px;
  1200. opacity: 0;
  1201. background-color: transparent;
  1202. border: none;
  1203. transition: 60ms ease-out;
  1204. font-size: ${p => p.theme.fontSizeMedium};
  1205. color: ${p => p.theme.subText};
  1206. padding: 0 2px;
  1207. display: flex;
  1208. align-items: center;
  1209. svg {
  1210. fill: ${p => p.theme.subText};
  1211. }
  1212. &.Left {
  1213. left: 0;
  1214. }
  1215. &.Right {
  1216. right: 0;
  1217. transform: rotate(180deg);
  1218. }
  1219. }
  1220. .TraceBarDuration {
  1221. display: inline-block;
  1222. transform-origin: left center;
  1223. font-size: ${p => p.theme.fontSizeExtraSmall};
  1224. color: ${p => p.theme.gray300};
  1225. white-space: nowrap;
  1226. font-variant-numeric: tabular-nums;
  1227. position: absolute;
  1228. }
  1229. .TraceChildrenCount {
  1230. height: 16px;
  1231. white-space: nowrap;
  1232. min-width: 30px;
  1233. display: flex;
  1234. align-items: center;
  1235. justify-content: center;
  1236. border-radius: 99px;
  1237. padding: 0px 4px;
  1238. transition: all 0.15s ease-in-out;
  1239. background: ${p => p.theme.background};
  1240. border: 1.5px solid var(--row-children-button-border-color);
  1241. line-height: 0;
  1242. z-index: 1;
  1243. font-size: 10px;
  1244. box-shadow: ${p => p.theme.dropShadowLight};
  1245. margin-right: 8px;
  1246. .TraceChildrenCountContent {
  1247. + .TraceChildrenCountAction {
  1248. margin-left: 2px;
  1249. }
  1250. }
  1251. .TraceChildrenCountAction {
  1252. position: relative;
  1253. display: flex;
  1254. align-items: center;
  1255. justify-content: center;
  1256. }
  1257. .TraceActionsLoadingIndicator {
  1258. margin: 0;
  1259. position: absolute;
  1260. top: 50%;
  1261. left: 50%;
  1262. transform: translate(-50%, -50%);
  1263. background-color: ${p => p.theme.background};
  1264. animation: show 0.1s ease-in-out forwards;
  1265. @keyframes show {
  1266. from {
  1267. opacity: 0;
  1268. transform: translate(-50%, -50%) scale(0.86);
  1269. }
  1270. to {
  1271. opacity: 1;
  1272. transform: translate(-50%, -50%) scale(1);
  1273. }
  1274. }
  1275. .loading-indicator {
  1276. border-width: 2px;
  1277. }
  1278. .loading-message {
  1279. display: none;
  1280. }
  1281. }
  1282. svg {
  1283. width: 7px;
  1284. transition: none;
  1285. }
  1286. }
  1287. .TraceChildrenCountWrapper {
  1288. display: flex;
  1289. justify-content: flex-end;
  1290. align-items: center;
  1291. min-width: 44px;
  1292. height: 100%;
  1293. position: relative;
  1294. button {
  1295. transition: none;
  1296. }
  1297. svg {
  1298. fill: currentColor;
  1299. }
  1300. &.Orphaned {
  1301. .TraceVerticalConnector,
  1302. .TraceVerticalLastChildConnector,
  1303. .TraceExpandedVerticalConnector {
  1304. border-left: 2px dashed ${p => p.theme.border};
  1305. }
  1306. &::before {
  1307. border-bottom: 2px dashed ${p => p.theme.border};
  1308. }
  1309. }
  1310. &.Root {
  1311. &:before,
  1312. .TraceVerticalLastChildConnector {
  1313. visibility: hidden;
  1314. }
  1315. }
  1316. &::before {
  1317. content: '';
  1318. display: block;
  1319. width: 50%;
  1320. height: 2px;
  1321. border-bottom: 2px solid ${p => p.theme.border};
  1322. position: absolute;
  1323. left: 0;
  1324. top: 50%;
  1325. transform: translateY(-50%);
  1326. }
  1327. &::after {
  1328. content: '';
  1329. background-color: ${p => p.theme.border};
  1330. border-radius: 50%;
  1331. height: 6px;
  1332. width: 6px;
  1333. position: absolute;
  1334. left: 50%;
  1335. top: 50%;
  1336. transform: translateY(-50%);
  1337. }
  1338. }
  1339. .TraceVerticalConnector {
  1340. position: absolute;
  1341. left: 0;
  1342. top: 0;
  1343. bottom: 0;
  1344. height: 100%;
  1345. width: 2px;
  1346. border-left: 2px solid ${p => p.theme.border};
  1347. &.Orphaned {
  1348. border-left: 2px dashed ${p => p.theme.border};
  1349. }
  1350. }
  1351. .TraceVerticalLastChildConnector {
  1352. position: absolute;
  1353. left: 0;
  1354. top: 0;
  1355. bottom: 0;
  1356. height: 50%;
  1357. width: 2px;
  1358. border-left: 2px solid ${p => p.theme.border};
  1359. border-bottom-left-radius: 4px;
  1360. }
  1361. .TraceExpandedVerticalConnector {
  1362. position: absolute;
  1363. bottom: 0;
  1364. height: 50%;
  1365. left: 50%;
  1366. width: 2px;
  1367. border-left: 2px solid ${p => p.theme.border};
  1368. }
  1369. .TraceOperation {
  1370. margin-left: 4px;
  1371. text-overflow: ellipsis;
  1372. white-space: nowrap;
  1373. font-weight: ${p => p.theme.fontWeightBold};
  1374. }
  1375. .TraceEmDash {
  1376. margin-left: 4px;
  1377. margin-right: 4px;
  1378. }
  1379. .TraceDescription {
  1380. white-space: nowrap;
  1381. }
  1382. `;