groupEventDetailsContent.tsx 7.5 KB

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