groupEventDetailsContent.tsx 11 KB

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