parentAutogroup.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
  6. import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceState/traceTabs';
  7. import {
  8. makeTraceNodeBarColor,
  9. type ParentAutogroupNode,
  10. } from '../../traceModels/traceTree';
  11. import {IssueList} from './issues/issues';
  12. import {type SectionCardKeyValueList, TraceDrawerComponents} from './styles';
  13. export function ParentAutogroupNodeDetails({
  14. node,
  15. organization,
  16. onParentClick,
  17. onTabScrollToNode,
  18. }: TraceTreeNodeDetailsProps<ParentAutogroupNode>) {
  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(
  29. 'Chain of immediate and only children spans with the same operation as their parent.'
  30. ),
  31. },
  32. {
  33. key: 'group_count',
  34. subject: t('Group Count'),
  35. value: node.groupCount,
  36. },
  37. {
  38. key: 'grouping_key',
  39. subject: t('Grouping Key'),
  40. value: `${t('Span Operation')} : ${node.value.op}`,
  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.HeaderContainer>
  57. <TraceDrawerComponents.Title>
  58. <TraceDrawerComponents.IconTitleWrapper>
  59. <TraceDrawerComponents.IconBorder
  60. backgroundColor={makeTraceNodeBarColor(theme, node)}
  61. >
  62. <IconGroup size="md" />
  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.HeaderContainer>
  73. <IssueList issues={issues} node={node} organization={organization} />
  74. <TraceDrawerComponents.SectionCard items={items} title={t('General')} />
  75. </TraceDrawerComponents.DetailContainer>
  76. );
  77. }