groupEventDetailsContent.tsx 11 KB

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