groupEventDetailsContent.tsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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 AggregateSpanDiff from 'sentry/components/events/eventStatisticalDetector/aggregateSpanDiff';
  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 {EventFunctionRegressionEvidence} from 'sentry/components/events/eventStatisticalDetector/eventFunctionRegressionEvidence';
  22. import {EventFunctionBreakpointChart} from 'sentry/components/events/eventStatisticalDetector/functionBreakpointChart';
  23. import RegressionMessage from 'sentry/components/events/eventStatisticalDetector/regressionMessage';
  24. import {EventTagsAndScreenshot} from 'sentry/components/events/eventTagsAndScreenshot';
  25. import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy';
  26. import {EventGroupingInfo} from 'sentry/components/events/groupingInfo';
  27. import {ActionableItems} from 'sentry/components/events/interfaces/crashContent/exception/actionableItems';
  28. import {actionableItemsEnabled} from 'sentry/components/events/interfaces/crashContent/exception/useActionableItems';
  29. import {CronTimelineSection} from 'sentry/components/events/interfaces/crons/cronTimelineSection';
  30. import {AnrRootCause} from 'sentry/components/events/interfaces/performance/anrRootCause';
  31. import {SpanEvidenceSection} from 'sentry/components/events/interfaces/performance/spanEvidence';
  32. import {EventPackageData} from 'sentry/components/events/packageData';
  33. import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration';
  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. <EventCause
  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. <RegressionMessage event={event} group={group} />
  186. <ErrorBoundary mini>
  187. <EventBreakpointChart event={event} />
  188. </ErrorBoundary>
  189. <ErrorBoundary mini>
  190. <AggregateSpanDiff event={event} projectId={project.id} />
  191. </ErrorBoundary>
  192. <ErrorBoundary mini>
  193. <EventComparison event={event} project={project} />
  194. </ErrorBoundary>
  195. </Fragment>
  196. </Feature>
  197. );
  198. }
  199. function ProfilingDurationRegressionIssueDetailsContent({
  200. group,
  201. event,
  202. project,
  203. }: Required<GroupEventDetailsContentProps>) {
  204. const organization = useOrganization();
  205. return (
  206. <Feature
  207. features={['profile-function-regression-exp-visible']}
  208. organization={organization}
  209. renderDisabled
  210. >
  211. <Fragment>
  212. <RegressionMessage event={event} group={group} />
  213. <ErrorBoundary mini>
  214. <EventFunctionBreakpointChart event={event} />
  215. </ErrorBoundary>
  216. <ErrorBoundary mini>
  217. <EventFunctionRegressionEvidence event={event} />
  218. </ErrorBoundary>
  219. <ErrorBoundary mini>
  220. <EventAffectedTransactions event={event} group={group} project={project} />
  221. </ErrorBoundary>
  222. <ErrorBoundary mini>
  223. <EventFunctionComparisonList event={event} group={group} project={project} />
  224. </ErrorBoundary>
  225. </Fragment>
  226. </Feature>
  227. );
  228. }
  229. function GroupEventDetailsContent({
  230. group,
  231. event,
  232. project,
  233. }: GroupEventDetailsContentProps) {
  234. if (!event) {
  235. return (
  236. <NotFoundMessage>
  237. <h3>{t('Latest event not available')}</h3>
  238. </NotFoundMessage>
  239. );
  240. }
  241. switch (group.issueType) {
  242. case IssueType.PERFORMANCE_DURATION_REGRESSION: {
  243. return (
  244. <PerformanceDurationRegressionIssueDetailsContent
  245. group={group}
  246. event={event}
  247. project={project}
  248. />
  249. );
  250. }
  251. case IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL: {
  252. return (
  253. <ProfilingDurationRegressionIssueDetailsContent
  254. group={group}
  255. event={event}
  256. project={project}
  257. />
  258. );
  259. }
  260. default: {
  261. return (
  262. <DefaultGroupEventDetailsContent group={group} event={event} project={project} />
  263. );
  264. }
  265. }
  266. }
  267. const NotFoundMessage = styled('div')`
  268. padding: ${space(2)} ${space(4)};
  269. `;
  270. export default GroupEventDetailsContent;