parentAutogroup.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 {Row} from 'sentry/views/performance/traceDetails/styles';
  8. import {
  9. makeTraceNodeBarColor,
  10. type ParentAutogroupNode,
  11. } from '../../traceModels/traceTree';
  12. import {IssueList} from './issues/issues';
  13. import {TraceDrawerComponents} from './styles';
  14. export function ParentAutogroupNodeDetails({
  15. node,
  16. organization,
  17. onParentClick,
  18. onTabScrollToNode,
  19. }: TraceTreeNodeDetailsProps<ParentAutogroupNode>) {
  20. const theme = useTheme();
  21. const issues = useMemo(() => {
  22. return [...node.errors, ...node.performance_issues];
  23. }, [node.errors, node.performance_issues]);
  24. const parentTransaction = node.parent_transaction;
  25. return (
  26. <TraceDrawerComponents.DetailContainer>
  27. <TraceDrawerComponents.HeaderContainer>
  28. <TraceDrawerComponents.Title>
  29. <TraceDrawerComponents.IconTitleWrapper>
  30. <TraceDrawerComponents.IconBorder
  31. backgroundColor={makeTraceNodeBarColor(theme, node)}
  32. >
  33. <IconGroup size="md" />
  34. </TraceDrawerComponents.IconBorder>
  35. <div style={{fontWeight: 'bold'}}>{t('Autogroup')}</div>
  36. </TraceDrawerComponents.IconTitleWrapper>
  37. </TraceDrawerComponents.Title>
  38. <TraceDrawerComponents.NodeActions
  39. organization={organization}
  40. node={node}
  41. onTabScrollToNode={onTabScrollToNode}
  42. />
  43. </TraceDrawerComponents.HeaderContainer>
  44. <IssueList issues={issues} node={node} organization={organization} />
  45. <TraceDrawerComponents.Table className="table key-value">
  46. <tbody>
  47. {parentTransaction ? (
  48. <Row title="Parent Transaction">
  49. <td className="value">
  50. <a onClick={() => onParentClick(parentTransaction)}>
  51. {getTraceTabTitle(parentTransaction)}
  52. </a>
  53. </td>
  54. </Row>
  55. ) : null}
  56. <Row title={t('Grouping Logic')}>
  57. {t(
  58. 'Chain of immediate and only children spans with the same operation as their parent.'
  59. )}
  60. </Row>
  61. <Row title={t('Group Count')}>{node.groupCount}</Row>
  62. <Row title={t('Grouping Key')}>
  63. {t('Span Operation')} : {node.value.op}
  64. </Row>
  65. </tbody>
  66. </TraceDrawerComponents.Table>
  67. </TraceDrawerComponents.DetailContainer>
  68. );
  69. }