sessionTerm.tsx 6.2 KB

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