groupEventDetailsContent.tsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 {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 {EventAffectedTransactions} from 'sentry/components/events/eventStatisticalDetector/eventAffectedTransactions';
  19. import EventComparison from 'sentry/components/events/eventStatisticalDetector/eventComparison';
  20. import {EventFunctionComparisonList} from 'sentry/components/events/eventStatisticalDetector/eventFunctionComparisonList';
  21. import {EventFunctionBreakpointChart} from 'sentry/components/events/eventStatisticalDetector/functionBreakpointChart';
  22. import RegressionMessage from 'sentry/components/events/eventStatisticalDetector/regressionMessage';
  23. import {EventTagsAndScreenshot} from 'sentry/components/events/eventTagsAndScreenshot';
  24. import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy';
  25. import {EventGroupingInfo} from 'sentry/components/events/groupingInfo';
  26. import {ActionableItems} from 'sentry/components/events/interfaces/crashContent/exception/actionableItems';
  27. import {actionableItemsEnabled} from 'sentry/components/events/interfaces/crashContent/exception/useActionableItems';
  28. import {CronTimelineSection} from 'sentry/components/events/interfaces/crons/cronTimelineSection';
  29. import {AnrRootCause} from 'sentry/components/events/interfaces/performance/anrRootCause';
  30. import {SpanEvidenceSection} from 'sentry/components/events/interfaces/performance/spanEvidence';
  31. import {EventPackageData} from 'sentry/components/events/packageData';
  32. import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration';
  33. import {EventUserFeedback} from 'sentry/components/events/userFeedback';
  34. import {t} from 'sentry/locale';
  35. import {space} from 'sentry/styles/space';
  36. import {Event, Group, IssueCategory, IssueType, Project} from 'sentry/types';
  37. import {EntryType, EventTransaction} from 'sentry/types/event';
  38. import {useLocation} from 'sentry/utils/useLocation';
  39. import useOrganization from 'sentry/utils/useOrganization';
  40. import {ResourcesAndMaybeSolutions} from 'sentry/views/issueDetails/resourcesAndMaybeSolutions';
  41. type GroupEventDetailsContentProps = {
  42. group: Group;
  43. project: Project;
  44. event?: Event;
  45. };
  46. type GroupEventEntryProps = {
  47. entryType: EntryType;
  48. event: Event;
  49. group: Group;
  50. project: Project;
  51. };
  52. function GroupEventEntry({event, entryType, group, project}: GroupEventEntryProps) {
  53. const organization = useOrganization();
  54. const matchingEntry = event.entries.find(entry => entry.type === entryType);
  55. if (!matchingEntry) {
  56. return null;
  57. }
  58. return (
  59. <EventEntry
  60. projectSlug={project.slug}
  61. group={group}
  62. entry={matchingEntry}
  63. {...{organization, event}}
  64. />
  65. );
  66. }
  67. function DefaultGroupEventDetailsContent({
  68. group,
  69. event,
  70. project,
  71. }: Required<GroupEventDetailsContentProps>) {
  72. const organization = useOrganization();
  73. const location = useLocation();
  74. const projectSlug = project.slug;
  75. const hasReplay = Boolean(event.tags?.find(({key}) => key === 'replayId')?.value);
  76. const mechanism = event.tags?.find(({key}) => key === 'mechanism')?.value;
  77. const isANR = mechanism === 'ANR' || mechanism === 'AppExitInfo';
  78. const hasAnrImprovementsFeature = organization.features.includes('anr-improvements');
  79. const eventEntryProps = {group, event, project};
  80. const hasActionableItems = actionableItemsEnabled({
  81. eventId: event.id,
  82. organization,
  83. projectSlug,
  84. });
  85. return (
  86. <Fragment>
  87. {hasActionableItems && (
  88. <ActionableItems event={event} project={project} isShare={false} />
  89. )}
  90. <EventCause
  91. project={project}
  92. eventId={event.id}
  93. group={group}
  94. commitRow={CommitRow}
  95. />
  96. {event.userReport && (
  97. <EventDataSection title="User Feedback" type="user-feedback">
  98. <EventUserFeedback
  99. report={event.userReport}
  100. orgSlug={organization.slug}
  101. issueId={group.id}
  102. />
  103. </EventDataSection>
  104. )}
  105. {group.issueCategory === IssueCategory.CRON && (
  106. <CronTimelineSection event={event} organization={organization} />
  107. )}
  108. <EventTagsAndScreenshot
  109. event={event}
  110. organization={organization}
  111. projectSlug={project.slug}
  112. location={location}
  113. />
  114. <EventEvidence event={event} group={group} projectSlug={project.slug} />
  115. <GroupEventEntry entryType={EntryType.MESSAGE} {...eventEntryProps} />
  116. <GroupEventEntry entryType={EntryType.EXCEPTION} {...eventEntryProps} />
  117. <GroupEventEntry entryType={EntryType.STACKTRACE} {...eventEntryProps} />
  118. <GroupEventEntry entryType={EntryType.THREADS} {...eventEntryProps} />
  119. {hasAnrImprovementsFeature && isANR && (
  120. <AnrRootCause event={event} organization={organization} />
  121. )}
  122. {group.issueCategory === IssueCategory.PERFORMANCE && (
  123. <SpanEvidenceSection
  124. event={event as EventTransaction}
  125. organization={organization}
  126. projectSlug={project.slug}
  127. />
  128. )}
  129. <EventReplay event={event} group={group} projectSlug={project.slug} />
  130. <GroupEventEntry entryType={EntryType.HPKP} {...eventEntryProps} />
  131. <GroupEventEntry entryType={EntryType.CSP} {...eventEntryProps} />
  132. <GroupEventEntry entryType={EntryType.EXPECTCT} {...eventEntryProps} />
  133. <GroupEventEntry entryType={EntryType.EXPECTSTAPLE} {...eventEntryProps} />
  134. <GroupEventEntry entryType={EntryType.TEMPLATE} {...eventEntryProps} />
  135. <GroupEventEntry entryType={EntryType.BREADCRUMBS} {...eventEntryProps} />
  136. <ResourcesAndMaybeSolutions
  137. event={event}
  138. projectSlug={project.slug}
  139. group={group}
  140. />
  141. <GroupEventEntry entryType={EntryType.DEBUGMETA} {...eventEntryProps} />
  142. <GroupEventEntry entryType={EntryType.REQUEST} {...eventEntryProps} />
  143. <EventContexts group={group} event={event} />
  144. <EventExtraData event={event} />
  145. <EventPackageData event={event} />
  146. <EventDevice event={event} />
  147. <EventViewHierarchy event={event} project={project} />
  148. <EventAttachments event={event} projectSlug={project.slug} />
  149. <EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
  150. {event.groupID && (
  151. <EventGroupingInfo
  152. projectSlug={project.slug}
  153. event={event}
  154. showGroupingConfig={
  155. organization.features.includes('set-grouping-config') &&
  156. 'groupingConfig' in event
  157. }
  158. group={group}
  159. />
  160. )}
  161. {!hasReplay && (
  162. <EventRRWebIntegration
  163. event={event}
  164. orgId={organization.slug}
  165. projectSlug={project.slug}
  166. />
  167. )}
  168. </Fragment>
  169. );
  170. }
  171. function PerformanceDurationRegressionIssueDetailsContent({
  172. group,
  173. event,
  174. project,
  175. }: Required<GroupEventDetailsContentProps>) {
  176. const organization = useOrganization();
  177. return (
  178. <Feature
  179. features={['performance-duration-regression-visible']}
  180. organization={organization}
  181. renderDisabled
  182. >
  183. <Fragment>
  184. <RegressionMessage event={event} group={group} />
  185. <ErrorBoundary mini>
  186. <EventBreakpointChart event={event} />
  187. </ErrorBoundary>
  188. <ErrorBoundary mini>
  189. <EventSpanOpBreakdown event={event} />
  190. </ErrorBoundary>
  191. <ErrorBoundary mini>
  192. <EventComparison event={event} group={group} project={project} />
  193. </ErrorBoundary>
  194. </Fragment>
  195. </Feature>
  196. );
  197. }
  198. function ProfilingDurationRegressionIssueDetailsContent({
  199. group,
  200. event,
  201. project,
  202. }: Required<GroupEventDetailsContentProps>) {
  203. const organization = useOrganization();
  204. return (
  205. <Feature
  206. features={['profile-function-regression-exp-visible']}
  207. organization={organization}
  208. renderDisabled
  209. >
  210. <Fragment>
  211. <RegressionMessage event={event} group={group} />
  212. <ErrorBoundary mini>
  213. <EventFunctionBreakpointChart event={event} />
  214. </ErrorBoundary>
  215. <ErrorBoundary mini>
  216. <EventAffectedTransactions event={event} group={group} project={project} />
  217. </ErrorBoundary>
  218. <ErrorBoundary mini>
  219. <EventFunctionComparisonList event={event} group={group} project={project} />
  220. </ErrorBoundary>
  221. </Fragment>
  222. </Feature>
  223. );
  224. }
  225. function GroupEventDetailsContent({
  226. group,
  227. event,
  228. project,
  229. }: GroupEventDetailsContentProps) {
  230. if (!event) {
  231. return (
  232. <NotFoundMessage>
  233. <h3>{t('Latest event not available')}</h3>
  234. </NotFoundMessage>
  235. );
  236. }
  237. switch (group.issueType) {
  238. case IssueType.PERFORMANCE_DURATION_REGRESSION: {
  239. return (
  240. <PerformanceDurationRegressionIssueDetailsContent
  241. group={group}
  242. event={event}
  243. project={project}
  244. />
  245. );
  246. }
  247. case IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL: {
  248. return (
  249. <ProfilingDurationRegressionIssueDetailsContent
  250. group={group}
  251. event={event}
  252. project={project}
  253. />
  254. );
  255. }
  256. default: {
  257. return (
  258. <DefaultGroupEventDetailsContent group={group} event={event} project={project} />
  259. );
  260. }
  261. }
  262. }
  263. const NotFoundMessage = styled('div')`
  264. padding: ${space(2)} ${space(4)};
  265. `;
  266. export default GroupEventDetailsContent;