groupEventDetailsContent.tsx 11 KB

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