sessionTerm.tsx 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. import {PlatformKey} from 'sentry/data/platformCategories';
  2. import {t} from 'sentry/locale';
  3. export enum SessionTerm {
  4. CRASHES = 'crashes',
  5. CRASHED = 'crashed',
  6. ABNORMAL = 'abnormal',
  7. CRASH_FREE = 'crashFree',
  8. CRASH_FREE_USERS = 'crash-free-users',
  9. CRASH_FREE_SESSIONS = 'crash-free-sessions',
  10. HEALTHY = 'healthy',
  11. ERRORED = 'errored',
  12. UNHANDLED = 'unhandled',
  13. STABILITY = 'stability',
  14. ADOPTION = 'adoption',
  15. }
  16. export const sessionTerm = {
  17. [SessionTerm.CRASHES]: t('Crashes'),
  18. [SessionTerm.CRASHED]: t('Crashed'),
  19. [SessionTerm.ABNORMAL]: t('Abnormal'),
  20. [SessionTerm.CRASH_FREE_USERS]: t('Crash Free Users'),
  21. [SessionTerm.CRASH_FREE_SESSIONS]: t('Crash Free Sessions'),
  22. [SessionTerm.HEALTHY]: t('Healthy'),
  23. [SessionTerm.ERRORED]: t('Errored'),
  24. [SessionTerm.UNHANDLED]: t('Unhandled'),
  25. [SessionTerm.ADOPTION]: t('Adoption'),
  26. duration: t('Session Duration'),
  27. otherCrashed: t('Other Crashed'),
  28. otherAbnormal: t('Other Abnormal'),
  29. otherErrored: t('Other Errored'),
  30. otherHealthy: t('Other Healthy'),
  31. otherCrashFreeUsers: t('Other Crash Free Users'),
  32. otherCrashFreeSessions: t('Other Crash Free Sessions'),
  33. otherReleases: t('Other Releases'),
  34. };
  35. // This should never be used directly (except in tests)
  36. export const commonTermsDescription = {
  37. [SessionTerm.CRASHES]: t('Number of sessions with a crashed state'),
  38. [SessionTerm.CRASH_FREE]: t(
  39. 'Percentage of sessions/users who did not experience a crash.'
  40. ),
  41. [SessionTerm.CRASH_FREE_USERS]: t(
  42. 'Percentage of unique users with non-crashed sessions'
  43. ),
  44. [SessionTerm.CRASH_FREE_SESSIONS]: t('Percentage of non-crashed sessions'),
  45. [SessionTerm.STABILITY]: t('The percentage of crash free sessions.'),
  46. [SessionTerm.ADOPTION]: t(
  47. 'Adoption compares the sessions or users of a release with the total sessions or users for this project in the last 24 hours.'
  48. ),
  49. };
  50. // This should never be used directly (except in tests)
  51. export const mobileTermsDescription = {
  52. [SessionTerm.CRASHED]: t(
  53. 'The process was terminated due to an unhandled exception or a request to the server that ended with an error'
  54. ),
  55. [SessionTerm.CRASH_FREE_SESSIONS]: t('Percentage of non-crashed sessions'),
  56. [SessionTerm.ABNORMAL]: t(
  57. 'An unknown session exit. Like due to loss of power or killed by the operating system'
  58. ),
  59. [SessionTerm.HEALTHY]: t('A session without errors'),
  60. [SessionTerm.ERRORED]: t('A session with errors'),
  61. [SessionTerm.UNHANDLED]: t('Not handled by user code'),
  62. };
  63. // This should never be used directly (except in tests)
  64. export const desktopTermDescriptions = {
  65. crashed: t('The application crashed with a hard crash (eg. segfault)'),
  66. [SessionTerm.ABNORMAL]: t(
  67. 'The application did not properly end the session, for example, due to force-quit'
  68. ),
  69. [SessionTerm.HEALTHY]: t(
  70. 'The application exited normally and did not observe any errors'
  71. ),
  72. [SessionTerm.ERRORED]: t(
  73. 'The application exited normally but observed error events while running'
  74. ),
  75. [SessionTerm.UNHANDLED]: t('The application crashed with a hard crash'),
  76. };
  77. function getTermDescriptions(platform: PlatformKey | null) {
  78. const technology =
  79. platform === 'react-native' ||
  80. platform === 'java-spring' ||
  81. platform === 'apple-ios' ||
  82. platform === 'dotnet-aspnetcore'
  83. ? platform
  84. : platform?.split('-')[0];
  85. switch (technology) {
  86. case 'dotnet':
  87. case 'java':
  88. return {
  89. ...commonTermsDescription,
  90. ...mobileTermsDescription,
  91. };
  92. case 'java-spring':
  93. case 'dotnet-aspnetcore':
  94. return {
  95. ...commonTermsDescription,
  96. ...mobileTermsDescription,
  97. [SessionTerm.CRASHES]: t(
  98. 'A request that resulted in an unhandled exception and hence a Server Error response'
  99. ),
  100. };
  101. case 'android':
  102. case 'cordova':
  103. case 'react-native':
  104. case 'flutter':
  105. return {
  106. ...commonTermsDescription,
  107. ...mobileTermsDescription,
  108. [SessionTerm.CRASHED]: t(
  109. 'An unhandled exception that resulted in the application crashing'
  110. ),
  111. };
  112. case 'apple': {
  113. return {
  114. ...commonTermsDescription,
  115. ...mobileTermsDescription,
  116. [SessionTerm.CRASHED]: t('An error that resulted in the application crashing'),
  117. };
  118. }
  119. case 'node':
  120. case 'javascript':
  121. return {
  122. ...commonTermsDescription,
  123. [SessionTerm.CRASHED]: t(
  124. 'During the session an unhandled global error/promise rejection occurred.'
  125. ),
  126. [SessionTerm.ABNORMAL]: t('Non applicable for Javascript.'),
  127. [SessionTerm.HEALTHY]: t('No errors were captured during session life-time.'),
  128. [SessionTerm.ERRORED]: t(
  129. 'During the session at least one handled error occurred.'
  130. ),
  131. [SessionTerm.UNHANDLED]:
  132. "An error was captured by the global 'onerror' or 'onunhandledrejection' handler.",
  133. };
  134. case 'apple-ios':
  135. case 'minidump':
  136. case 'native':
  137. return {
  138. ...commonTermsDescription,
  139. ...desktopTermDescriptions,
  140. };
  141. case 'rust':
  142. return {
  143. ...commonTermsDescription,
  144. ...desktopTermDescriptions,
  145. [SessionTerm.CRASHED]: t('The application had an unrecoverable error (a panic)'),
  146. };
  147. default:
  148. return {
  149. ...commonTermsDescription,
  150. [SessionTerm.CRASHED]: t('Number of users who experienced an unhandled error'),
  151. [SessionTerm.ABNORMAL]: t('An unknown session exit'),
  152. [SessionTerm.HEALTHY]: mobileTermsDescription.healthy,
  153. [SessionTerm.ERRORED]: mobileTermsDescription.errored,
  154. [SessionTerm.UNHANDLED]: mobileTermsDescription.unhandled,
  155. };
  156. }
  157. }
  158. export function getSessionTermDescription(
  159. term: SessionTerm,
  160. platform: PlatformKey | null
  161. ) {
  162. return getTermDescriptions(platform)[term];
  163. }