traceDataSection.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {t} from 'sentry/locale';
  4. import {space} from 'sentry/styles/space';
  5. import type {Event} from 'sentry/types/event';
  6. import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
  7. import {TraceIssueEvent} from './traceTimeline/traceIssue';
  8. import {TraceLink} from './traceTimeline/traceLink';
  9. import {TraceTimeline} from './traceTimeline/traceTimeline';
  10. import {useTraceTimelineEvents} from './traceTimeline/useTraceTimelineEvents';
  11. export function TraceDataSection({event}: {event: Event}) {
  12. // This is also called within the TraceTimeline component but caching will save a second call
  13. const {isLoading, oneOtherIssueEvent} = useTraceTimelineEvents({
  14. event,
  15. });
  16. let params: Record<string, boolean> = {};
  17. if (!isLoading && oneOtherIssueEvent !== undefined) {
  18. params = {
  19. has_related_trace_issue: true,
  20. };
  21. }
  22. useRouteAnalyticsParams(params);
  23. if (isLoading) {
  24. return null;
  25. }
  26. return (
  27. <Fragment>
  28. <StyledTraceLink>
  29. {/* Used for trace-related issue */}
  30. {oneOtherIssueEvent && (
  31. <span>{t('One other issue appears in the same trace.')}</span>
  32. )}
  33. <TraceLink event={event} />
  34. </StyledTraceLink>
  35. {oneOtherIssueEvent === undefined ? (
  36. <TraceTimeline event={event} />
  37. ) : (
  38. <TraceIssueEvent event={oneOtherIssueEvent} />
  39. )}
  40. </Fragment>
  41. );
  42. }
  43. const StyledTraceLink = styled('div')`
  44. display: flex;
  45. white-space: nowrap;
  46. overflow: hidden;
  47. gap: ${space(0.25)};
  48. `;