groupEventDetailsContent.tsx 11 KB

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