groupEventDetailsContent.tsx 11 KB

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