groupEventDetailsContent.tsx 12 KB

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