stackTraceV2.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import styled from '@emotion/styled';
  2. import CrashContent from 'sentry/components/events/interfaces/crashContent';
  3. import {t} from 'sentry/locale';
  4. import {Group, PlatformType, Project} from 'sentry/types';
  5. import {Event} from 'sentry/types/event';
  6. import {STACK_TYPE, STACK_VIEW} from 'sentry/types/stacktrace';
  7. import {TraceEventDataSection} from '../traceEventDataSection';
  8. import CrashContentStackTrace from './crashContent/stackTrace';
  9. import NoStackTraceMessage from './noStackTraceMessage';
  10. import {isStacktraceNewestFirst} from './utils';
  11. type CrashContentProps = React.ComponentProps<typeof CrashContent>;
  12. type Props = Pick<
  13. CrashContentProps,
  14. 'groupingCurrentLevel' | 'hasHierarchicalGrouping'
  15. > & {
  16. data: NonNullable<CrashContentProps['stacktrace']>;
  17. event: Event;
  18. projectId: Project['id'];
  19. type: string;
  20. groupingCurrentLevel?: Group['metadata']['current_level'];
  21. hideGuide?: boolean;
  22. };
  23. function StackTrace({
  24. projectId,
  25. event,
  26. data,
  27. type,
  28. hasHierarchicalGrouping,
  29. groupingCurrentLevel,
  30. }: Props) {
  31. function getPlatform(): PlatformType {
  32. const framePlatform = data.frames?.find(frame => !!frame.platform);
  33. return framePlatform?.platform ?? event.platform ?? 'other';
  34. }
  35. const platform = getPlatform();
  36. const stackTraceNotFound = !(data.frames ?? []).length;
  37. return (
  38. <TraceEventDataSection
  39. type={type}
  40. stackType={STACK_TYPE.ORIGINAL}
  41. projectId={projectId}
  42. eventId={event.id}
  43. platform={platform}
  44. stackTraceNotFound={stackTraceNotFound}
  45. recentFirst={isStacktraceNewestFirst()}
  46. fullStackTrace={!data.hasSystemFrames}
  47. title={<Title>{t('Stack Trace')}</Title>}
  48. wrapTitle={false}
  49. hasMinified={false}
  50. hasVerboseFunctionNames={
  51. !!data.frames?.some(
  52. frame =>
  53. !!frame.rawFunction &&
  54. !!frame.function &&
  55. frame.rawFunction !== frame.function
  56. )
  57. }
  58. hasAbsoluteFilePaths={!!data.frames?.some(frame => !!frame.filename)}
  59. hasAbsoluteAddresses={!!data.frames?.some(frame => !!frame.instructionAddr)}
  60. hasAppOnlyFrames={!!data.frames?.some(frame => frame.inApp !== true)}
  61. hasNewestFirst={(data.frames ?? []).length > 1}
  62. showPermalink
  63. >
  64. {({recentFirst, display, fullStackTrace}) =>
  65. stackTraceNotFound ? (
  66. <NoStackTraceMessage />
  67. ) : (
  68. <CrashContentStackTrace
  69. event={event}
  70. platform={platform}
  71. stackView={
  72. display.includes('raw-stack-trace')
  73. ? STACK_VIEW.RAW
  74. : fullStackTrace
  75. ? STACK_VIEW.FULL
  76. : STACK_VIEW.APP
  77. }
  78. newestFirst={recentFirst}
  79. stacktrace={data}
  80. groupingCurrentLevel={groupingCurrentLevel}
  81. hasHierarchicalGrouping={hasHierarchicalGrouping}
  82. nativeV2
  83. />
  84. )
  85. }
  86. </TraceEventDataSection>
  87. );
  88. }
  89. export default StackTrace;
  90. const Title = styled('h3')`
  91. margin-bottom: 0;
  92. `;