index.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 IssueQuickTrace from './issueQuickTrace';
  7. type Props = {
  8. event: Event;
  9. group: Group;
  10. location: Location;
  11. organization: Organization;
  12. isPerformanceIssue?: boolean;
  13. };
  14. function QuickTrace({event, organization, location, isPerformanceIssue}: Props) {
  15. const hasPerformanceView = organization.features.includes('performance-view');
  16. const hasTraceContext = Boolean(event.contexts?.trace?.trace_id);
  17. const quickTrace = useContext(QuickTraceContext);
  18. return (
  19. <Fragment>
  20. {hasPerformanceView && hasTraceContext && (
  21. <IssueQuickTrace
  22. organization={organization}
  23. event={event}
  24. location={location}
  25. isPerformanceIssue={isPerformanceIssue}
  26. quickTrace={quickTrace!}
  27. />
  28. )}
  29. </Fragment>
  30. );
  31. }
  32. export default QuickTrace;