issueQuickTrace.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import styled from '@emotion/styled';
  2. import {Location} from 'history';
  3. import ErrorBoundary from 'sentry/components/errorBoundary';
  4. import QuickTrace from 'sentry/components/quickTrace';
  5. import {space} from 'sentry/styles/space';
  6. import type {Organization} from 'sentry/types';
  7. import {Event} from 'sentry/types/event';
  8. import {defined} from 'sentry/utils';
  9. import {QuickTraceQueryChildrenProps} from 'sentry/utils/performance/quickTrace/types';
  10. import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
  11. import {TraceLink} from 'sentry/views/issueDetails/quickTrace/traceLink';
  12. type Props = {
  13. event: Event;
  14. location: Location;
  15. organization: Organization;
  16. quickTrace: undefined | QuickTraceQueryChildrenProps;
  17. };
  18. function IssueQuickTrace({event, location, organization, quickTrace}: Props) {
  19. const isTraceMissing =
  20. !quickTrace ||
  21. quickTrace.error ||
  22. !defined(quickTrace.trace) ||
  23. quickTrace.trace.length === 0;
  24. useRouteAnalyticsParams({
  25. trace_status: isTraceMissing
  26. ? quickTrace?.type === 'missing'
  27. ? 'transaction missing'
  28. : 'trace missing'
  29. : 'success',
  30. });
  31. if (isTraceMissing) {
  32. return (
  33. <QuickTraceWrapper>
  34. <TraceLink event={event} noTrace />
  35. </QuickTraceWrapper>
  36. );
  37. }
  38. return (
  39. <ErrorBoundary mini>
  40. <QuickTraceWrapper>
  41. <QuickTrace
  42. event={event}
  43. quickTrace={quickTrace}
  44. location={location}
  45. organization={organization}
  46. anchor="left"
  47. errorDest="issue"
  48. transactionDest="performance"
  49. />
  50. <TraceLink noTrace={false} event={event} />
  51. </QuickTraceWrapper>
  52. </ErrorBoundary>
  53. );
  54. }
  55. const QuickTraceWrapper = styled('div')`
  56. display: flex;
  57. align-items: center;
  58. flex-wrap: wrap;
  59. margin-top: ${space(0.75)};
  60. height: 20px;
  61. `;
  62. export default IssueQuickTrace;