siblingAutogroup.tsx 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
  6. import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';
  7. import {
  8. makeTraceNodeBarColor,
  9. type SiblingAutogroupNode,
  10. } from '../../traceModels/traceTree';
  11. import {IssueList} from './issues/issues';
  12. import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';
  13. export function SiblingAutogroupNodeDetails({
  14. node,
  15. organization,
  16. onParentClick,
  17. onTabScrollToNode,
  18. }: TraceTreeNodeDetailsProps<SiblingAutogroupNode>) {
  19. const theme = useTheme();
  20. const issues = useMemo(() => {
  21. return [...node.errors, ...node.performance_issues];
  22. }, [node.errors, node.performance_issues]);
  23. const parentTransaction = node.parent_transaction;
  24. const items: SectionCardKeyValueList = [
  25. {
  26. key: 'grouping_logic',
  27. subject: t('Grouping Logic'),
  28. value: t('5 or more sibling spans with the same operation and description.'),
  29. },
  30. {
  31. key: 'group_count',
  32. subject: t('Group Count'),
  33. value: node.groupCount,
  34. },
  35. {
  36. key: 'grouping_key',
  37. subject: t('Grouping Key'),
  38. value: tct('Span operation: [operation] and description: [description]', {
  39. operation: node.value.op,
  40. description: node.value.description,
  41. }),
  42. },
  43. ];
  44. if (parentTransaction) {
  45. items.push({
  46. key: 'parent_transaction',
  47. subject: t('Parent Transaction'),
  48. value: (
  49. <a onClick={() => onParentClick(parentTransaction)}>
  50. {getTraceTabTitle(parentTransaction)}
  51. </a>
  52. ),
  53. });
  54. }
  55. return (
  56. <TraceDrawerComponents.DetailContainer>
  57. <TraceDrawerComponents.HeaderContainer>
  58. <TraceDrawerComponents.Title>
  59. <TraceDrawerComponents.IconTitleWrapper>
  60. <TraceDrawerComponents.IconBorder
  61. backgroundColor={makeTraceNodeBarColor(theme, node)}
  62. >
  63. <IconGroup />
  64. </TraceDrawerComponents.IconBorder>
  65. <div style={{fontWeight: 'bold'}}>{t('Autogroup')}</div>
  66. </TraceDrawerComponents.IconTitleWrapper>
  67. </TraceDrawerComponents.Title>
  68. <TraceDrawerComponents.NodeActions
  69. organization={organization}
  70. node={node}
  71. onTabScrollToNode={onTabScrollToNode}
  72. />
  73. </TraceDrawerComponents.HeaderContainer>
  74. <IssueList issues={issues} node={node} organization={organization} />
  75. <TraceDrawerComponents.SectionCard items={items} title={t('General')} />
  76. </TraceDrawerComponents.DetailContainer>
  77. );
  78. }