parentAutogroup.tsx 2.8 KB

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