siblingAutogroup.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import {useMemo} from 'react';
  2. import {useTheme} from '@emotion/react';
  3. import {IconGroup} from 'sentry/icons';
  4. import {t, tct} from 'sentry/locale';
  5. import type {Organization} from 'sentry/types';
  6. import {getTraceTabTitle} from 'sentry/views/performance/newTraceDetails/traceTabs';
  7. import {Row} from 'sentry/views/performance/traceDetails/styles';
  8. import {
  9. makeTraceNodeBarColor,
  10. type SiblingAutogroupNode,
  11. type TraceTree,
  12. type TraceTreeNode,
  13. } from '../../traceTree';
  14. import {IssueList} from './issues/issues';
  15. import {TraceDrawerComponents} from './styles';
  16. export function SiblingAutogroupNodeDetails({
  17. node,
  18. organization,
  19. onParentClick,
  20. }: {
  21. node: SiblingAutogroupNode;
  22. onParentClick: (node: TraceTreeNode<TraceTree.NodeValue>) => void;
  23. organization: Organization;
  24. }) {
  25. const theme = useTheme();
  26. const issues = useMemo(() => {
  27. return [...node.errors, ...node.performance_issues];
  28. }, [node.errors, node.performance_issues]);
  29. const parentTransaction = node.parent_transaction;
  30. return (
  31. <TraceDrawerComponents.DetailContainer>
  32. <TraceDrawerComponents.IconTitleWrapper>
  33. <TraceDrawerComponents.IconBorder
  34. backgroundColor={makeTraceNodeBarColor(theme, node)}
  35. >
  36. <IconGroup />
  37. </TraceDrawerComponents.IconBorder>
  38. <div style={{fontWeight: 'bold'}}>{t('Autogroup')}</div>
  39. </TraceDrawerComponents.IconTitleWrapper>
  40. <IssueList issues={issues} node={node} organization={organization} />
  41. <TraceDrawerComponents.Table className="table key-value">
  42. <tbody>
  43. {parentTransaction ? (
  44. <Row title="Parent Transaction">
  45. <td className="value">
  46. <a href="#" onClick={() => onParentClick(parentTransaction)}>
  47. {getTraceTabTitle(parentTransaction)}
  48. </a>
  49. </td>
  50. </Row>
  51. ) : null}
  52. <Row title={t('Grouping Logic')}>
  53. {t('5 or more sibling spans with the same operation and description.')}
  54. </Row>
  55. <Row title={t('Group Count')}>{node.groupCount}</Row>
  56. <Row title={t('Grouping Key')}>
  57. {tct('Span operation: [operation] and description: [description]', {
  58. operation: node.value.op,
  59. description: node.value.description,
  60. })}
  61. </Row>
  62. </tbody>
  63. </TraceDrawerComponents.Table>
  64. </TraceDrawerComponents.DetailContainer>
  65. );
  66. }