fields.tsx 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import {MetricsOperation, MetricsType} from 'sentry/types';
  2. import {ColumnType} from '../discover/fields';
  3. export enum SessionMetric {
  4. SESSION = 'sentry.sessions.session',
  5. SESSION_DURATION = 'sentry.sessions.session.duration',
  6. SESSION_ERROR = 'sentry.sessions.session.error',
  7. SESSION_CRASH_FREE_RATE = 'session.crash_free_rate',
  8. USER_CRASH_FREE_RATE = 'session.crash_free_user_rate',
  9. SESSION_CRASH_RATE = 'session.crash_rate',
  10. USER_CRASH_RATE = 'session.crash_user_rate',
  11. USER = 'sentry.sessions.user',
  12. SESSION_HEALTHY = 'session.healthy',
  13. USER_HEALTHY = 'session.healthy_user',
  14. SESSION_ABNORMAL = 'session.abnormal',
  15. USER_ABNORMAL = 'session.abnormal_user',
  16. SESSION_CRASHED = 'session.crashed',
  17. USER_CRASHED = 'session.crashed_user',
  18. SESSION_ERRORED = 'session.errored',
  19. USER_ERRORED = 'session.errored_user',
  20. }
  21. export enum TransactionMetric {
  22. MEASUREMENTS_FP = 'sentry.transactions.measurements.fp',
  23. MEASUREMENTS_FCP = 'sentry.transactions.measurements.fcp',
  24. MEASUREMENTS_LCP = 'sentry.transactions.measurements.lcp',
  25. MEASUREMENTS_FID = 'sentry.transactions.measurements.fid',
  26. MEASUREMENTS_CLS = 'sentry.transactions.measurements.cls',
  27. MEASUREMENTS_TTFB = 'sentry.transactions.measurements.ttfb',
  28. MEASUREMENTS_TTFB_REQUESTTIME = 'sentry.transactions.measurements.ttfb.requesttime',
  29. MEASUREMENTS_APP_START_COLD = 'sentry.transactions.measurements.app_start_cold',
  30. MEASUREMENTS_APP_START_WARM = 'sentry.transactions.measurements.app_start_warm',
  31. MEASUREMENTS_FRAMES_TOTAL = 'sentry.transactions.measurements.frames_total',
  32. MEASUREMENTS_FRAMES_SLOW = 'sentry.transactions.measurements.frames_slow',
  33. MEASUREMENTS_FRAMES_FROZEN = 'sentry.transactions.measurements.frames_frozen',
  34. MEASUREMENTS_FRAMES_SLOW_RATE = 'sentry.transactions.measurements.frames_slow_rate',
  35. MEASUREMENTS_FRAMES_FROZEN_RATE = 'sentry.transactions.measurements.frames_frozen_rate',
  36. MEASUREMENTS_STALL_COUNT = 'sentry.transactions.measurements.stall_count',
  37. MEASUREMENTS_STALL_TOTAL_TIME = 'sentry.transactions.measurements.stall_total_time',
  38. MEASUREMENTS_STALL_LONGEST_TIME = 'sentry.transactions.measurements.stall_longest_time',
  39. MEASUREMENTS_STALL_PERCENTAGE = 'sentry.transactions.measurements.stall_percentage',
  40. TRANSACTION_DURATION = 'sentry.transactions.transaction.duration',
  41. USER = 'sentry.transactions.user',
  42. TRANSACTION = 'transaction',
  43. }
  44. export const METRIC_TO_COLUMN_TYPE: Readonly<
  45. Record<SessionMetric | TransactionMetric, ColumnType>
  46. > = {
  47. // Session metrics
  48. [SessionMetric.USER]: 'integer',
  49. [SessionMetric.SESSION_ERROR]: 'integer',
  50. [SessionMetric.SESSION_DURATION]: 'duration',
  51. [SessionMetric.SESSION]: 'integer',
  52. [SessionMetric.SESSION_CRASH_FREE_RATE]: 'percentage',
  53. [SessionMetric.USER_CRASH_FREE_RATE]: 'percentage',
  54. [SessionMetric.SESSION_CRASH_RATE]: 'percentage',
  55. [SessionMetric.USER_CRASH_RATE]: 'percentage',
  56. [SessionMetric.SESSION_HEALTHY]: 'integer',
  57. [SessionMetric.USER_HEALTHY]: 'integer',
  58. [SessionMetric.SESSION_ABNORMAL]: 'integer',
  59. [SessionMetric.USER_ABNORMAL]: 'integer',
  60. [SessionMetric.SESSION_CRASHED]: 'integer',
  61. [SessionMetric.USER_CRASHED]: 'integer',
  62. [SessionMetric.SESSION_ERRORED]: 'integer',
  63. [SessionMetric.USER_ERRORED]: 'integer',
  64. // Transaction metrics
  65. [TransactionMetric.USER]: 'integer',
  66. [TransactionMetric.TRANSACTION]: 'string',
  67. [TransactionMetric.TRANSACTION_DURATION]: 'duration',
  68. [TransactionMetric.MEASUREMENTS_FP]: 'duration',
  69. [TransactionMetric.MEASUREMENTS_FCP]: 'duration',
  70. [TransactionMetric.MEASUREMENTS_LCP]: 'duration',
  71. [TransactionMetric.MEASUREMENTS_FID]: 'duration',
  72. [TransactionMetric.MEASUREMENTS_CLS]: 'number',
  73. [TransactionMetric.MEASUREMENTS_TTFB]: 'duration',
  74. [TransactionMetric.MEASUREMENTS_TTFB_REQUESTTIME]: 'duration',
  75. [TransactionMetric.MEASUREMENTS_APP_START_COLD]: 'duration',
  76. [TransactionMetric.MEASUREMENTS_APP_START_WARM]: 'duration',
  77. [TransactionMetric.MEASUREMENTS_FRAMES_TOTAL]: 'integer',
  78. [TransactionMetric.MEASUREMENTS_FRAMES_SLOW]: 'integer',
  79. [TransactionMetric.MEASUREMENTS_FRAMES_FROZEN]: 'integer',
  80. [TransactionMetric.MEASUREMENTS_FRAMES_SLOW_RATE]: 'percentage',
  81. [TransactionMetric.MEASUREMENTS_FRAMES_FROZEN_RATE]: 'percentage',
  82. [TransactionMetric.MEASUREMENTS_STALL_COUNT]: 'integer',
  83. [TransactionMetric.MEASUREMENTS_STALL_TOTAL_TIME]: 'duration',
  84. [TransactionMetric.MEASUREMENTS_STALL_LONGEST_TIME]: 'duration',
  85. [TransactionMetric.MEASUREMENTS_STALL_PERCENTAGE]: 'percentage',
  86. };
  87. export const METRICS_OPERATIONS: Readonly<
  88. Record<
  89. MetricsOperation,
  90. {defaultValue: SessionMetric | TransactionMetric; metricsTypes: MetricsType[]}
  91. >
  92. > = {
  93. sum: {
  94. metricsTypes: ['counter'],
  95. defaultValue: SessionMetric.SESSION,
  96. },
  97. count_unique: {
  98. metricsTypes: ['set'],
  99. defaultValue: SessionMetric.USER,
  100. },
  101. avg: {
  102. metricsTypes: ['distribution'],
  103. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  104. },
  105. count: {
  106. metricsTypes: ['distribution'],
  107. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  108. },
  109. max: {
  110. metricsTypes: ['distribution'],
  111. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  112. },
  113. p50: {
  114. metricsTypes: ['distribution'],
  115. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  116. },
  117. p75: {
  118. metricsTypes: ['distribution'],
  119. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  120. },
  121. p95: {
  122. metricsTypes: ['distribution'],
  123. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  124. },
  125. p99: {
  126. metricsTypes: ['distribution'],
  127. defaultValue: TransactionMetric.TRANSACTION_DURATION,
  128. },
  129. };