parentAutogroup.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 {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 ParentAutogroupNode,
  11. type TraceTree,
  12. type TraceTreeNode,
  13. } from '../../traceTree';
  14. import {IssueList} from './issues/issues';
  15. import {TraceDrawerComponents} from './styles';
  16. export function ParentAutogroupNodeDetails({
  17. node,
  18. organization,
  19. onParentClick,
  20. }: {
  21. node: ParentAutogroupNode;
  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 size="md" />
  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(
  54. 'Chain of immediate and only children spans with the same operation as their parent.'
  55. )}
  56. </Row>
  57. <Row title={t('Group Count')}>{node.groupCount}</Row>
  58. <Row title={t('Grouping Key')}>
  59. {t('Span Operation')} : {node.value.op}
  60. </Row>
  61. </tbody>
  62. </TraceDrawerComponents.Table>
  63. </TraceDrawerComponents.DetailContainer>
  64. );
  65. }