siblingAutogroup.tsx 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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, tct} 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 SiblingAutogroupNode} from '../../traceTree';
  10. import {IssueList} from './issues/issues';
  11. import {TraceDrawerComponents} from './styles';
  12. export function SiblingAutogroupNodeDetails({
  13. node,
  14. organization,
  15. onParentClick,
  16. scrollToNode,
  17. }: TraceTreeNodeDetailsProps<SiblingAutogroupNode>) {
  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 />
  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('5 or more sibling spans with the same operation and description.')}
  56. </Row>
  57. <Row title={t('Group Count')}>{node.groupCount}</Row>
  58. <Row title={t('Grouping Key')}>
  59. {tct('Span operation: [operation] and description: [description]', {
  60. operation: node.value.op,
  61. description: node.value.description,
  62. })}
  63. </Row>
  64. </tbody>
  65. </TraceDrawerComponents.Table>
  66. </TraceDrawerComponents.DetailContainer>
  67. );
  68. }