siblingAutogroup.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import {useMemo} from 'react';
  2. import {useTheme} from '@emotion/react';
  3. import {IconGroup} from 'sentry/icons';
  4. import {t, tct} from 'sentry/locale';
  5. import type {TraceTreeNodeDetailsProps} from '../../traceDrawer/tabs/traceTreeNodeDetails';
  6. import type {SiblingAutogroupNode} from '../../traceModels/siblingAutogroupNode';
  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 SiblingAutogroupNodeDetails({
  13. node,
  14. organization,
  15. onParentClick,
  16. onTabScrollToNode,
  17. }: TraceTreeNodeDetailsProps<SiblingAutogroupNode>) {
  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('5 or more sibling spans with the same operation and description.'),
  28. },
  29. {
  30. key: 'group_count',
  31. subject: t('Group Count'),
  32. value: node.groupCount,
  33. },
  34. {
  35. key: 'grouping_key',
  36. subject: t('Grouping Key'),
  37. value: tct('Span operation: [operation] and description: [description]', {
  38. operation: node.value.op,
  39. description: node.value.description,
  40. }),
  41. },
  42. ];
  43. if (parentTransaction) {
  44. items.push({
  45. key: 'parent_transaction',
  46. subject: t('Parent Transaction'),
  47. value: (
  48. <a onClick={() => onParentClick(parentTransaction)}>
  49. {getTraceTabTitle(parentTransaction)}
  50. </a>
  51. ),
  52. });
  53. }
  54. return (
  55. <TraceDrawerComponents.DetailContainer>
  56. <TraceDrawerComponents.LegacyHeaderContainer>
  57. <TraceDrawerComponents.Title>
  58. <TraceDrawerComponents.IconTitleWrapper>
  59. <TraceDrawerComponents.IconBorder
  60. backgroundColor={makeTraceNodeBarColor(theme, node)}
  61. >
  62. <IconGroup />
  63. </TraceDrawerComponents.IconBorder>
  64. <div style={{fontWeight: 'bold'}}>{t('Autogroup')}</div>
  65. </TraceDrawerComponents.IconTitleWrapper>
  66. </TraceDrawerComponents.Title>
  67. <TraceDrawerComponents.NodeActions
  68. organization={organization}
  69. node={node}
  70. onTabScrollToNode={onTabScrollToNode}
  71. />
  72. </TraceDrawerComponents.LegacyHeaderContainer>
  73. <IssueList issues={issues} node={node} organization={organization} />
  74. <TraceDrawerComponents.SectionCard items={items} title={t('General')} />
  75. </TraceDrawerComponents.DetailContainer>
  76. );
  77. }