index.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {Fragment, useContext} from 'react';
  2. import {Location} from 'history';
  3. import {Group, Organization} from 'sentry/types';
  4. import {Event} from 'sentry/types/event';
  5. import {QuickTraceContext} from 'sentry/utils/performance/quickTrace/quickTraceContext';
  6. import DistributedTracingPrompt from './configureDistributedTracing';
  7. import IssueQuickTrace from './issueQuickTrace';
  8. type Props = {
  9. event: Event;
  10. group: Group;
  11. location: Location;
  12. organization: Organization;
  13. isPerformanceIssue?: boolean;
  14. };
  15. function QuickTrace({event, group, organization, location, isPerformanceIssue}: Props) {
  16. const hasPerformanceView = organization.features.includes('performance-view');
  17. const hasTraceContext = Boolean(event.contexts?.trace?.trace_id);
  18. const quickTrace = useContext(QuickTraceContext);
  19. return (
  20. <Fragment>
  21. {!hasTraceContext && (
  22. <DistributedTracingPrompt
  23. event={event}
  24. project={group.project}
  25. organization={organization}
  26. />
  27. )}
  28. {hasPerformanceView && hasTraceContext && (
  29. <IssueQuickTrace
  30. organization={organization}
  31. event={event}
  32. location={location}
  33. isPerformanceIssue={isPerformanceIssue}
  34. quickTrace={quickTrace!}
  35. />
  36. )}
  37. </Fragment>
  38. );
  39. }
  40. export default QuickTrace;