samplingAnalyticsEvents.tsx 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import {SamplingInnerName} from 'sentry/types/sampling';
  2. type Rule = {
  3. conditions: SamplingInnerName[] | string[];
  4. conditions_stringified: string;
  5. project_id: string;
  6. sampling_rate: number | null;
  7. };
  8. export type SamplingEventParameters = {
  9. 'sampling.performance.metrics.accuracy.alert': {
  10. project_id: string;
  11. };
  12. 'sampling.sdk.client.rate.change.alert': {
  13. project_id: string;
  14. };
  15. 'sampling.sdk.incompatible.alert': {
  16. project_id: string;
  17. };
  18. 'sampling.sdk.updgrades.alert': {
  19. project_id: string;
  20. };
  21. 'sampling.settings.modal.recommended.next.steps_back': {
  22. project_id: string;
  23. };
  24. 'sampling.settings.modal.recommended.next.steps_cancel': {
  25. project_id: string;
  26. };
  27. 'sampling.settings.modal.recommended.next.steps_done': {
  28. project_id: string;
  29. };
  30. 'sampling.settings.modal.recommended.next.steps_read_docs': {
  31. project_id: string;
  32. };
  33. 'sampling.settings.modal.specific.rule.condition_add': {
  34. conditions: SamplingInnerName[] | string[];
  35. project_id: string;
  36. };
  37. 'sampling.settings.modal.specify.client.open': {
  38. project_id: string;
  39. };
  40. 'sampling.settings.modal.specify.client.rate_cancel': {
  41. project_id: string;
  42. };
  43. 'sampling.settings.modal.specify.client.rate_next': {
  44. project_id: string;
  45. };
  46. 'sampling.settings.modal.specify.client.rate_read_docs': {
  47. project_id: string;
  48. };
  49. 'sampling.settings.modal.uniform.rate_cancel': {
  50. project_id: string;
  51. };
  52. 'sampling.settings.modal.uniform.rate_done': {
  53. project_id: string;
  54. };
  55. 'sampling.settings.modal.uniform.rate_next': {
  56. project_id: string;
  57. };
  58. 'sampling.settings.modal.uniform.rate_read_docs': {
  59. project_id: string;
  60. };
  61. 'sampling.settings.modal.uniform.rate_switch_current': {
  62. project_id: string;
  63. };
  64. 'sampling.settings.modal.uniform.rate_switch_recommended': {
  65. project_id: string;
  66. };
  67. 'sampling.settings.rule.specific_activate': Rule;
  68. 'sampling.settings.rule.specific_create': Rule;
  69. 'sampling.settings.rule.specific_deactivate': Rule;
  70. 'sampling.settings.rule.specific_delete': Rule;
  71. 'sampling.settings.rule.specific_save': Rule;
  72. 'sampling.settings.rule.specific_update': Rule & {
  73. old_conditions: Rule['conditions'];
  74. old_conditions_stringified: string;
  75. old_sampling_rate: Rule['sampling_rate'];
  76. };
  77. 'sampling.settings.rule.uniform_activate': {
  78. project_id: string;
  79. sampling_rate: Rule['sampling_rate'];
  80. };
  81. 'sampling.settings.rule.uniform_create': {
  82. old_sampling_rate: Rule['sampling_rate'];
  83. project_id: string;
  84. sampling_rate: Rule['sampling_rate'];
  85. };
  86. 'sampling.settings.rule.uniform_deactivate': {
  87. project_id: string;
  88. sampling_rate: Rule['sampling_rate'];
  89. };
  90. 'sampling.settings.rule.uniform_save': {
  91. old_sampling_rate: Rule['sampling_rate'];
  92. project_id: string;
  93. sampling_rate: Rule['sampling_rate'];
  94. };
  95. 'sampling.settings.rule.uniform_update': {
  96. old_sampling_rate: Rule['sampling_rate'];
  97. project_id: string;
  98. sampling_rate: Rule['sampling_rate'];
  99. };
  100. 'sampling.settings.view': {project_id: string};
  101. 'sampling.settings.view_get_started': {
  102. project_id: string;
  103. };
  104. 'sampling.settings.view_read_docs': {
  105. project_id: string;
  106. };
  107. };
  108. type SamplingAnalyticsKey = keyof SamplingEventParameters;
  109. export const samplingEventMap: Record<SamplingAnalyticsKey, string> = {
  110. 'sampling.performance.metrics.accuracy.alert':
  111. 'Sampling Performance Metrics Accuracy Alert',
  112. 'sampling.sdk.client.rate.change.alert': 'Recommended sdk client rate change alert',
  113. 'sampling.sdk.updgrades.alert': 'Recommended sdk upgrades alert',
  114. 'sampling.sdk.incompatible.alert': 'Incompatible sdk upgrades alert',
  115. 'sampling.settings.modal.recommended.next.steps_back': 'Go back to uniform rate step',
  116. 'sampling.settings.modal.recommended.next.steps_cancel':
  117. 'Cancel at recommended next steps step ',
  118. 'sampling.settings.modal.recommended.next.steps_done':
  119. 'Create uniform rule at recommended next steps step',
  120. 'sampling.settings.modal.recommended.next.steps_read_docs':
  121. 'Read docs at recommended next steps step',
  122. 'sampling.settings.rule.specific_activate': 'Activate specific rule',
  123. 'sampling.settings.modal.uniform.rate_cancel': 'Cancel at uniform rate step',
  124. 'sampling.settings.rule.specific_deactivate': 'Deactivate specific rule',
  125. 'sampling.settings.modal.uniform.rate_done': 'Create uniform rule at uniform rate step',
  126. 'sampling.settings.modal.uniform.rate_next': 'Go to recommended next steps step',
  127. 'sampling.settings.modal.uniform.rate_read_docs': 'Read docs at uniform rate step',
  128. 'sampling.settings.modal.uniform.rate_switch_current':
  129. 'Switch to current uniform rate step',
  130. 'sampling.settings.modal.uniform.rate_switch_recommended':
  131. 'Switch to recommended next steps step',
  132. 'sampling.settings.modal.specific.rule.condition_add': 'Add sampling condition',
  133. 'sampling.settings.modal.specify.client.rate_read_docs':
  134. 'Read docs at specify client rate step',
  135. 'sampling.settings.modal.specify.client.rate_cancel':
  136. 'Cancel at specify client rate step',
  137. 'sampling.settings.modal.specify.client.rate_next': 'Go to uniform rate step',
  138. 'sampling.settings.modal.specify.client.open': 'Open specify client step',
  139. 'sampling.settings.rule.specific_create': 'Create specific sampling rule',
  140. 'sampling.settings.rule.specific_delete': 'Delete specific sampling rule',
  141. 'sampling.settings.rule.specific_save': 'Save specific sampling rule', // fired for both create and update
  142. 'sampling.settings.rule.specific_update': 'Update specific sampling rule',
  143. 'sampling.settings.rule.uniform_activate': 'Activate uniform sampling rule',
  144. 'sampling.settings.rule.uniform_create': 'Create uniform sampling rule',
  145. 'sampling.settings.rule.uniform_deactivate': 'Deactivate uniform sampling rule',
  146. 'sampling.settings.rule.uniform_save': 'Save uniform sampling rule', // fired for both create and update
  147. 'sampling.settings.rule.uniform_update': 'Update uniform sampling rule',
  148. 'sampling.settings.view': 'View sampling settings',
  149. 'sampling.settings.view_get_started': 'Get started with sampling',
  150. 'sampling.settings.view_read_docs': 'Read sampling docs', // fired for all read docs buttons
  151. };