groupEventDetailsContent.tsx 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import Feature from 'sentry/components/acl/feature';
  4. import {CommitRow} from 'sentry/components/commitRow';
  5. import ErrorBoundary from 'sentry/components/errorBoundary';
  6. import {EventContexts} from 'sentry/components/events/contexts';
  7. import {EventDevice} from 'sentry/components/events/device';
  8. import {EventAttachments} from 'sentry/components/events/eventAttachments';
  9. import {EventCause} from 'sentry/components/events/eventCause';
  10. import {EventDataSection} from 'sentry/components/events/eventDataSection';
  11. import {EventEntry} from 'sentry/components/events/eventEntry';
  12. import {EventErrors} from 'sentry/components/events/eventErrors';
  13. import {EventEvidence} from 'sentry/components/events/eventEvidence';
  14. import {EventExtraData} from 'sentry/components/events/eventExtraData';
  15. import EventReplay from 'sentry/components/events/eventReplay';
  16. import {EventSdk} from 'sentry/components/events/eventSdk';
  17. import EventSpanOpBreakdown from 'sentry/components/events/eventStatisticalDetector/aggregateSpanOps/spanOpBreakdown';
  18. import EventBreakpointChart from 'sentry/components/events/eventStatisticalDetector/breakpointChart';
  19. import EventComparison from 'sentry/components/events/eventStatisticalDetector/eventComparison';
  20. import RegressionMessage from 'sentry/components/events/eventStatisticalDetector/regressionMessage';
  21. import {EventTagsAndScreenshot} from 'sentry/components/events/eventTagsAndScreenshot';
  22. import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy';
  23. import {EventGroupingInfo} from 'sentry/components/events/groupingInfo';
  24. import {ActionableItems} from 'sentry/components/events/interfaces/crashContent/exception/actionableItems';
  25. import {actionableItemsEnabled} from 'sentry/components/events/interfaces/crashContent/exception/useActionableItems';
  26. import {CronTimelineSection} from 'sentry/components/events/interfaces/crons/cronTimelineSection';
  27. import {AnrRootCause} from 'sentry/components/events/interfaces/performance/anrRootCause';
  28. import {SpanEvidenceSection} from 'sentry/components/events/interfaces/performance/spanEvidence';
  29. import {EventPackageData} from 'sentry/components/events/packageData';
  30. import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration';
  31. import {EventUserFeedback} from 'sentry/components/events/userFeedback';
  32. import {t} from 'sentry/locale';
  33. import {space} from 'sentry/styles/space';
  34. import {Event, Group, IssueCategory, IssueType, Project} from 'sentry/types';
  35. import {EntryType, EventTransaction} from 'sentry/types/event';
  36. import {useLocation} from 'sentry/utils/useLocation';
  37. import useOrganization from 'sentry/utils/useOrganization';
  38. import {ResourcesAndMaybeSolutions} from 'sentry/views/issueDetails/resourcesAndMaybeSolutions';
  39. type GroupEventDetailsContentProps = {
  40. group: Group;
  41. project: Project;
  42. event?: Event;
  43. };
  44. type GroupEventEntryProps = {
  45. entryType: EntryType;
  46. event: Event;
  47. group: Group;
  48. project: Project;
  49. };
  50. function GroupEventEntry({event, entryType, group, project}: GroupEventEntryProps) {
  51. const organization = useOrganization();
  52. const matchingEntry = event.entries.find(entry => entry.type === entryType);
  53. if (!matchingEntry) {
  54. return null;
  55. }
  56. return (
  57. <EventEntry
  58. projectSlug={project.slug}
  59. group={group}
  60. entry={matchingEntry}
  61. {...{organization, event}}
  62. />
  63. );
  64. }
  65. function GroupEventDetailsContent({
  66. group,
  67. event,
  68. project,
  69. }: GroupEventDetailsContentProps) {
  70. const organization = useOrganization();
  71. const location = useLocation();
  72. const projectSlug = project.slug;
  73. const hasReplay = Boolean(event?.tags?.find(({key}) => key === 'replayId')?.value);
  74. const mechanism = event?.tags?.find(({key}) => key === 'mechanism')?.value;
  75. const isANR = mechanism === 'ANR' || mechanism === 'AppExitInfo';
  76. const hasAnrImprovementsFeature = organization.features.includes('anr-improvements');
  77. if (!event) {
  78. return (
  79. <NotFoundMessage>
  80. <h3>{t('Latest event not available')}</h3>
  81. </NotFoundMessage>
  82. );
  83. }
  84. const eventEntryProps = {group, event, project};
  85. const hasActionableItems = actionableItemsEnabled({
  86. eventId: event.id,
  87. organization,
  88. projectSlug,
  89. });
  90. if (group.issueType === IssueType.PERFORMANCE_DURATION_REGRESSION) {
  91. return (
  92. <Feature
  93. features={['performance-duration-regression-visible']}
  94. organization={organization}
  95. renderDisabled
  96. >
  97. <Fragment>
  98. <RegressionMessage event={event} />
  99. <ErrorBoundary mini>
  100. <EventBreakpointChart event={event} />
  101. </ErrorBoundary>
  102. <ErrorBoundary mini>
  103. <EventSpanOpBreakdown event={event} />
  104. </ErrorBoundary>
  105. <ErrorBoundary mini>
  106. <EventComparison event={event} group={group} project={project} />
  107. </ErrorBoundary>
  108. </Fragment>
  109. </Feature>
  110. );
  111. }
  112. return (
  113. <Fragment>
  114. {!hasActionableItems && (
  115. <EventErrors event={event} project={project} isShare={false} />
  116. )}
  117. {hasActionableItems && (
  118. <ActionableItems event={event} project={project} isShare={false} />
  119. )}
  120. <EventCause
  121. project={project}
  122. eventId={event.id}
  123. group={group}
  124. commitRow={CommitRow}
  125. />
  126. {event.userReport && (
  127. <EventDataSection title="User Feedback" type="user-feedback">
  128. <EventUserFeedback
  129. report={event.userReport}
  130. orgSlug={organization.slug}
  131. issueId={group.id}
  132. />
  133. </EventDataSection>
  134. )}
  135. {group.issueCategory === IssueCategory.CRON && (
  136. <CronTimelineSection event={event} organization={organization} />
  137. )}
  138. <EventTagsAndScreenshot
  139. event={event}
  140. organization={organization}
  141. projectSlug={project.slug}
  142. location={location}
  143. />
  144. <EventEvidence event={event} group={group} projectSlug={project.slug} />
  145. <GroupEventEntry entryType={EntryType.MESSAGE} {...eventEntryProps} />
  146. <GroupEventEntry entryType={EntryType.EXCEPTION} {...eventEntryProps} />
  147. <GroupEventEntry entryType={EntryType.STACKTRACE} {...eventEntryProps} />
  148. <GroupEventEntry entryType={EntryType.THREADS} {...eventEntryProps} />
  149. {hasAnrImprovementsFeature && isANR && (
  150. <AnrRootCause event={event} organization={organization} />
  151. )}
  152. {group.issueCategory === IssueCategory.PERFORMANCE && (
  153. <SpanEvidenceSection
  154. event={event as EventTransaction}
  155. organization={organization}
  156. projectSlug={project.slug}
  157. />
  158. )}
  159. <EventReplay event={event} group={group} projectSlug={project.slug} />
  160. <GroupEventEntry entryType={EntryType.HPKP} {...eventEntryProps} />
  161. <GroupEventEntry entryType={EntryType.CSP} {...eventEntryProps} />
  162. <GroupEventEntry entryType={EntryType.EXPECTCT} {...eventEntryProps} />
  163. <GroupEventEntry entryType={EntryType.EXPECTSTAPLE} {...eventEntryProps} />
  164. <GroupEventEntry entryType={EntryType.TEMPLATE} {...eventEntryProps} />
  165. <GroupEventEntry entryType={EntryType.BREADCRUMBS} {...eventEntryProps} />
  166. <ResourcesAndMaybeSolutions
  167. event={event}
  168. projectSlug={project.slug}
  169. group={group}
  170. />
  171. <GroupEventEntry entryType={EntryType.DEBUGMETA} {...eventEntryProps} />
  172. <GroupEventEntry entryType={EntryType.REQUEST} {...eventEntryProps} />
  173. <EventContexts group={group} event={event} />
  174. <EventExtraData event={event} />
  175. <EventPackageData event={event} />
  176. <EventDevice event={event} />
  177. <EventViewHierarchy event={event} project={project} />
  178. <EventAttachments event={event} projectSlug={project.slug} />
  179. <EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
  180. {event.groupID && (
  181. <EventGroupingInfo
  182. projectSlug={project.slug}
  183. event={event}
  184. showGroupingConfig={
  185. organization.features.includes('set-grouping-config') &&
  186. 'groupingConfig' in event
  187. }
  188. group={group}
  189. />
  190. )}
  191. {!hasReplay && (
  192. <EventRRWebIntegration
  193. event={event}
  194. orgId={organization.slug}
  195. projectSlug={project.slug}
  196. />
  197. )}
  198. </Fragment>
  199. );
  200. }
  201. const NotFoundMessage = styled('div')`
  202. padding: ${space(2)} ${space(4)};
  203. `;
  204. export default GroupEventDetailsContent;