parentAutogroup.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import {useMemo} from 'react';
  2. import {useTheme} from '@emotion/react';
  3. import {Button} from 'sentry/components/button';
  4. import {IconGroup} from 'sentry/icons';
  5. import {t} from 'sentry/locale';
  6. import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
  7. import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceTabs';
  8. import {Row} from 'sentry/views/performance/traceDetails/styles';
  9. import {makeTraceNodeBarColor, type ParentAutogroupNode} from '../../traceTree';
  10. import {IssueList} from './issues/issues';
  11. import {TraceDrawerComponents} from './styles';
  12. export function ParentAutogroupNodeDetails({
  13. node,
  14. organization,
  15. onParentClick,
  16. scrollToNode,
  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 = node.parent_transaction;
  23. return (
  24. <TraceDrawerComponents.DetailContainer>
  25. <TraceDrawerComponents.HeaderContainer>
  26. <TraceDrawerComponents.Title>
  27. <TraceDrawerComponents.IconTitleWrapper>
  28. <TraceDrawerComponents.IconBorder
  29. backgroundColor={makeTraceNodeBarColor(theme, node)}
  30. >
  31. <IconGroup size="md" />
  32. </TraceDrawerComponents.IconBorder>
  33. <div style={{fontWeight: 'bold'}}>{t('Autogroup')}</div>
  34. </TraceDrawerComponents.IconTitleWrapper>
  35. </TraceDrawerComponents.Title>
  36. <TraceDrawerComponents.Actions>
  37. <Button size="xs" onClick={_e => scrollToNode(node)}>
  38. {t('Show in view')}
  39. </Button>
  40. </TraceDrawerComponents.Actions>
  41. </TraceDrawerComponents.HeaderContainer>
  42. <IssueList issues={issues} node={node} organization={organization} />
  43. <TraceDrawerComponents.Table className="table key-value">
  44. <tbody>
  45. {parentTransaction ? (
  46. <Row title="Parent Transaction">
  47. <td className="value">
  48. <a href="#" onClick={() => onParentClick(parentTransaction)}>
  49. {getTraceTabTitle(parentTransaction)}
  50. </a>
  51. </td>
  52. </Row>
  53. ) : null}
  54. <Row title={t('Grouping Logic')}>
  55. {t(
  56. 'Chain of immediate and only children spans with the same operation as their parent.'
  57. )}
  58. </Row>
  59. <Row title={t('Group Count')}>{node.groupCount}</Row>
  60. <Row title={t('Grouping Key')}>
  61. {t('Span Operation')} : {node.value.op}
  62. </Row>
  63. </tbody>
  64. </TraceDrawerComponents.Table>
  65. </TraceDrawerComponents.DetailContainer>
  66. );
  67. }