groupEventDetailsContent.tsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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 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 hasNewTagsUI = useHasNewTagsUI();
  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. <StyledDataSection>
  98. <SuspectCommits
  99. project={project}
  100. eventId={event.id}
  101. group={group}
  102. commitRow={CommitRow}
  103. />
  104. </StyledDataSection>
  105. {event.userReport && (
  106. <EventDataSection title={t('User Feedback')} type="user-feedback">
  107. <EventUserFeedback
  108. report={event.userReport}
  109. orgSlug={organization.slug}
  110. issueId={group.id}
  111. />
  112. </EventDataSection>
  113. )}
  114. {group.issueCategory === IssueCategory.CRON && (
  115. <CronTimelineSection
  116. event={event}
  117. organization={organization}
  118. project={project}
  119. />
  120. )}
  121. <HighlightsDataSection event={event} group={group} project={project} />
  122. {!hasNewTagsUI && (
  123. <EventTagsAndScreenshot event={event} projectSlug={project.slug} />
  124. )}
  125. {showMaybeSolutionsHigher && (
  126. <ResourcesAndMaybeSolutions event={event} project={project} group={group} />
  127. )}
  128. <EventEvidence event={event} group={group} project={project} />
  129. <GroupEventEntry entryType={EntryType.MESSAGE} {...eventEntryProps} />
  130. <GroupEventEntry entryType={EntryType.EXCEPTION} {...eventEntryProps} />
  131. <GroupEventEntry entryType={EntryType.STACKTRACE} {...eventEntryProps} />
  132. <GroupEventEntry entryType={EntryType.THREADS} {...eventEntryProps} />
  133. {hasAnrImprovementsFeature && isANR && (
  134. <AnrRootCause event={event} organization={organization} />
  135. )}
  136. {group.issueCategory === IssueCategory.PERFORMANCE && (
  137. <SpanEvidenceSection
  138. event={event as EventTransaction}
  139. organization={organization}
  140. projectSlug={project.slug}
  141. />
  142. )}
  143. <EventReplay event={event} group={group} projectSlug={project.slug} />
  144. <GroupEventEntry entryType={EntryType.HPKP} {...eventEntryProps} />
  145. <GroupEventEntry entryType={EntryType.CSP} {...eventEntryProps} />
  146. <GroupEventEntry entryType={EntryType.EXPECTCT} {...eventEntryProps} />
  147. <GroupEventEntry entryType={EntryType.EXPECTSTAPLE} {...eventEntryProps} />
  148. <GroupEventEntry entryType={EntryType.TEMPLATE} {...eventEntryProps} />
  149. <GroupEventEntry entryType={EntryType.BREADCRUMBS} {...eventEntryProps} />
  150. {!showMaybeSolutionsHigher && (
  151. <ResourcesAndMaybeSolutions event={event} project={project} group={group} />
  152. )}
  153. <GroupEventEntry entryType={EntryType.DEBUGMETA} {...eventEntryProps} />
  154. <GroupEventEntry entryType={EntryType.REQUEST} {...eventEntryProps} />
  155. {hasNewTagsUI && (
  156. <EventTagsAndScreenshot event={event} projectSlug={project.slug} />
  157. )}
  158. <EventContexts group={group} event={event} />
  159. <EventExtraData event={event} />
  160. <EventPackageData event={event} />
  161. <EventDevice event={event} />
  162. <EventViewHierarchy event={event} project={project} />
  163. <EventAttachments event={event} projectSlug={project.slug} />
  164. <EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
  165. {event.groupID && (
  166. <EventGroupingInfo
  167. projectSlug={project.slug}
  168. event={event}
  169. showGroupingConfig={
  170. organization.features.includes('set-grouping-config') &&
  171. 'groupingConfig' in event
  172. }
  173. group={group}
  174. />
  175. )}
  176. {!hasReplay && (
  177. <EventRRWebIntegration
  178. event={event}
  179. orgId={organization.slug}
  180. projectSlug={project.slug}
  181. />
  182. )}
  183. </Fragment>
  184. );
  185. }
  186. function PerformanceDurationRegressionIssueDetailsContent({
  187. group,
  188. event,
  189. project,
  190. }: Required<GroupEventDetailsContentProps>) {
  191. return (
  192. <Fragment>
  193. <ErrorBoundary mini>
  194. <EventRegressionSummary event={event} group={group} />
  195. </ErrorBoundary>
  196. <ErrorBoundary mini>
  197. <EventBreakpointChart event={event} />
  198. </ErrorBoundary>
  199. <ErrorBoundary mini>
  200. <AggregateSpanDiff event={event} project={project} />
  201. </ErrorBoundary>
  202. <ErrorBoundary mini>
  203. <EventComparison event={event} project={project} />
  204. </ErrorBoundary>
  205. </Fragment>
  206. );
  207. }
  208. function ProfilingDurationRegressionIssueDetailsContent({
  209. group,
  210. event,
  211. project,
  212. }: Required<GroupEventDetailsContentProps>) {
  213. return (
  214. <TransactionsDeltaProvider event={event} project={project}>
  215. <Fragment>
  216. <ErrorBoundary mini>
  217. <EventRegressionSummary event={event} group={group} />
  218. </ErrorBoundary>
  219. <ErrorBoundary mini>
  220. <EventFunctionBreakpointChart event={event} />
  221. </ErrorBoundary>
  222. <ErrorBoundary mini>
  223. <EventAffectedTransactions event={event} group={group} project={project} />
  224. </ErrorBoundary>
  225. <ErrorBoundary mini>
  226. <DataSection>
  227. <b>{t('Largest Changes in Call Stack Frequency')}</b>
  228. <p>
  229. {t(`See which functions changed the most before and after the regression. The
  230. frame with the largest increase in call stack population likely
  231. contributed to the cause for the duration regression.`)}
  232. </p>
  233. <EventDifferentialFlamegraph event={event} />
  234. </DataSection>
  235. </ErrorBoundary>
  236. <ErrorBoundary mini>
  237. <EventFunctionComparisonList event={event} group={group} project={project} />
  238. </ErrorBoundary>
  239. </Fragment>
  240. </TransactionsDeltaProvider>
  241. );
  242. }
  243. function GroupEventDetailsContent({
  244. group,
  245. event,
  246. project,
  247. }: GroupEventDetailsContentProps) {
  248. if (!event) {
  249. return (
  250. <NotFoundMessage>
  251. <h3>{t('Latest event not available')}</h3>
  252. </NotFoundMessage>
  253. );
  254. }
  255. switch (group.issueType) {
  256. case IssueType.PERFORMANCE_DURATION_REGRESSION:
  257. case IssueType.PERFORMANCE_ENDPOINT_REGRESSION: {
  258. return (
  259. <PerformanceDurationRegressionIssueDetailsContent
  260. group={group}
  261. event={event}
  262. project={project}
  263. />
  264. );
  265. }
  266. case IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL:
  267. case IssueType.PROFILE_FUNCTION_REGRESSION: {
  268. return (
  269. <ProfilingDurationRegressionIssueDetailsContent
  270. group={group}
  271. event={event}
  272. project={project}
  273. />
  274. );
  275. }
  276. default: {
  277. return (
  278. <DefaultGroupEventDetailsContent group={group} event={event} project={project} />
  279. );
  280. }
  281. }
  282. }
  283. const NotFoundMessage = styled('div')`
  284. padding: ${space(2)} ${space(4)};
  285. `;
  286. const StyledDataSection = styled(DataSection)`
  287. padding: ${space(0.5)} ${space(2)};
  288. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  289. padding: ${space(1)} ${space(4)};
  290. }
  291. &:empty {
  292. display: none;
  293. }
  294. `;
  295. export default GroupEventDetailsContent;