groupEventDetailsContent.tsx 11 KB

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