parentAutogroup.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {useMemo} from 'react';
  2. import {useTheme} from '@emotion/react';
  3. import {IconGroup} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import type {TraceTreeNodeDetailsProps} from '../../traceDrawer/tabs/traceTreeNodeDetails';
  6. import type {ParentAutogroupNode} from '../../traceModels/parentAutogroupNode';
  7. import {TraceTree} from '../../traceModels/traceTree';
  8. import {makeTraceNodeBarColor} from '../../traceRow/traceBar';
  9. import {getTraceTabTitle} from '../../traceState/traceTabs';
  10. import {IssueList} from './issues/issues';
  11. import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';
  12. export function ParentAutogroupNodeDetails({
  13. node,
  14. organization,
  15. onParentClick,
  16. onTabScrollToNode,
  17. }: TraceTreeNodeDetailsProps<ParentAutogroupNode>) {
  18. const theme = useTheme();
  19. const issues = useMemo(() => {
  20. return [...node.errors, ...node.performance_issues];
  21. }, [node.errors, node.performance_issues]);
  22. const parentTransaction = TraceTree.ParentTransaction(node);
  23. const items: SectionCardKeyValueList = [
  24. {
  25. key: 'grouping_logic',
  26. subject: t('Grouping Logic'),
  27. value: t(
  28. 'Chain of immediate and only children spans with the same operation as their parent.'
  29. ),
  30. },
  31. {
  32. key: 'group_count',
  33. subject: t('Group Count'),
  34. value: node.groupCount,
  35. },
  36. {
  37. key: 'grouping_key',
  38. subject: t('Grouping Key'),
  39. value: `${t('Span Operation')} : ${node.value.op}`,
  40. },
  41. ];
  42. if (parentTransaction) {
  43. items.push({
  44. key: 'parent_transaction',
  45. subject: t('Parent Transaction'),
  46. value: (
  47. <a onClick={() => onParentClick(parentTransaction)}>
  48. {getTraceTabTitle(parentTransaction)}
  49. </a>
  50. ),
  51. });
  52. }
  53. return (
  54. <TraceDrawerComponents.DetailContainer>
  55. <TraceDrawerComponents.LegacyHeaderContainer>
  56. <TraceDrawerComponents.Title>
  57. <TraceDrawerComponents.IconTitleWrapper>
  58. <TraceDrawerComponents.IconBorder
  59. backgroundColor={makeTraceNodeBarColor(theme, node)}
  60. >
  61. <IconGroup size="md" />
  62. </TraceDrawerComponents.IconBorder>
  63. <div style={{fontWeight: 'bold'}}>{t('Autogroup')}</div>
  64. </TraceDrawerComponents.IconTitleWrapper>
  65. </TraceDrawerComponents.Title>
  66. <TraceDrawerComponents.NodeActions
  67. organization={organization}
  68. node={node}
  69. onTabScrollToNode={onTabScrollToNode}
  70. />
  71. </TraceDrawerComponents.LegacyHeaderContainer>
  72. <IssueList issues={issues} node={node} organization={organization} />
  73. <TraceDrawerComponents.SectionCard items={items} title={t('General')} />
  74. </TraceDrawerComponents.DetailContainer>
  75. );
  76. }