groupEventDetailsContent.tsx 6.5 KB

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