index.ts 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import {IntegrationType, SentryAppStatus} from 'sentry/types';
  2. import {codeownersEventMap, CodeownersEventParameters} from './codeownersAnalyticsEvents';
  3. import {platformEventMap, PlatformEventParameters} from './platformAnalyticsEvents';
  4. import {
  5. stacktraceLinkEventMap,
  6. StacktraceLinkEventParameters,
  7. } from './stacktraceLinkAnalyticsEvents';
  8. export type IntegrationView = {
  9. view?:
  10. | 'external_install'
  11. | 'legacy_integrations'
  12. | 'plugin_details'
  13. | 'integrations_directory'
  14. | 'integrations_directory_integration_detail'
  15. | 'stacktrace_issue_details'
  16. | 'integration_configuration_detail'
  17. | 'onboarding'
  18. | 'project_creation'
  19. | 'developer_settings'
  20. | 'new_integration_modal';
  21. };
  22. type SingleIntegrationEventParams = {
  23. integration: string; // the slug
  24. integration_type: IntegrationType;
  25. already_installed?: boolean;
  26. // include the status since people might do weird things testing unpublished integrations
  27. integration_status?: SentryAppStatus;
  28. integration_tab?: 'configurations' | 'overview';
  29. plan?: string;
  30. } & IntegrationView;
  31. type MultipleIntegrationsEventParams = {
  32. integrations_installed: number;
  33. } & IntegrationView;
  34. type IntegrationSearchEventParams = {
  35. num_results: number;
  36. search_term: string;
  37. } & IntegrationView;
  38. type IntegrationCategorySelectEventParams = {
  39. category: string;
  40. } & IntegrationView;
  41. type IntegrationServerlessFunctionsViewedParams = {
  42. num_functions: number;
  43. } & SingleIntegrationEventParams;
  44. type IntegrationServerlessFunctionActionParams = {
  45. action: 'enable' | 'disable' | 'updateVersion';
  46. } & SingleIntegrationEventParams;
  47. type IntegrationInstallationInputValueChangeEventParams = {
  48. field_name: string;
  49. } & SingleIntegrationEventParams;
  50. // Event key to payload mappings
  51. export type IntegrationEventParameters = {
  52. 'integrations.cloudformation_link_clicked': SingleIntegrationEventParams;
  53. 'integrations.code_mappings_viewed': SingleIntegrationEventParams;
  54. 'integrations.config_saved': SingleIntegrationEventParams;
  55. 'integrations.details_viewed': SingleIntegrationEventParams;
  56. 'integrations.directory_category_selected': IntegrationCategorySelectEventParams;
  57. 'integrations.directory_item_searched': IntegrationSearchEventParams;
  58. 'integrations.disabled': SingleIntegrationEventParams;
  59. 'integrations.enabled': SingleIntegrationEventParams;
  60. 'integrations.index_viewed': MultipleIntegrationsEventParams;
  61. 'integrations.install_modal_opened': SingleIntegrationEventParams;
  62. 'integrations.installation_complete': SingleIntegrationEventParams;
  63. 'integrations.installation_input_value_changed': IntegrationInstallationInputValueChangeEventParams;
  64. 'integrations.installation_start': SingleIntegrationEventParams;
  65. 'integrations.integration_tab_clicked': SingleIntegrationEventParams;
  66. 'integrations.integration_viewed': SingleIntegrationEventParams;
  67. 'integrations.plugin_add_to_project_clicked': SingleIntegrationEventParams;
  68. 'integrations.request_install': SingleIntegrationEventParams;
  69. 'integrations.resolve_now_clicked': SingleIntegrationEventParams;
  70. 'integrations.serverless_function_action': IntegrationServerlessFunctionActionParams;
  71. 'integrations.serverless_functions_viewed': IntegrationServerlessFunctionsViewedParams;
  72. 'integrations.switch_manual_sdk_setup': SingleIntegrationEventParams;
  73. 'integrations.uninstall_clicked': SingleIntegrationEventParams;
  74. 'integrations.uninstall_completed': SingleIntegrationEventParams;
  75. 'integrations.upgrade_plan_modal_opened': SingleIntegrationEventParams;
  76. } & CodeownersEventParameters &
  77. StacktraceLinkEventParameters &
  78. PlatformEventParameters;
  79. export type IntegrationAnalyticsKey = keyof IntegrationEventParameters;
  80. // Event key to name mappings
  81. export const integrationEventMap: Record<IntegrationAnalyticsKey, string> = {
  82. 'integrations.upgrade_plan_modal_opened': 'Integrations: Upgrade Plan Modal Opened',
  83. 'integrations.install_modal_opened': 'Integrations: Install Modal Opened',
  84. 'integrations.integration_viewed': 'Integrations: Integration Viewed',
  85. 'integrations.installation_start': 'Integrations: Installation Start',
  86. 'integrations.installation_complete': 'Integrations: Installation Complete',
  87. 'integrations.uninstall_clicked': 'Integrations: Uninstall Clicked',
  88. 'integrations.uninstall_completed': 'Integrations: Uninstall Completed',
  89. 'integrations.enabled': 'Integrations: Enabled',
  90. 'integrations.disabled': 'Integrations: Disabled',
  91. 'integrations.config_saved': 'Integrations: Config Saved',
  92. 'integrations.integration_tab_clicked': 'Integrations: Integration Tab Clicked',
  93. 'integrations.plugin_add_to_project_clicked':
  94. 'Integrations: Plugin Add to Project Clicked',
  95. 'integrations.resolve_now_clicked': 'Integrations: Resolve Now Clicked',
  96. 'integrations.request_install': 'Integrations: Request Install',
  97. 'integrations.code_mappings_viewed': 'Integrations: Code Mappings Viewed',
  98. 'integrations.details_viewed': 'Integrations: Details Viewed',
  99. 'integrations.index_viewed': 'Integrations: Index Page Viewed',
  100. 'integrations.directory_item_searched': 'Integrations: Directory Item Searched',
  101. 'integrations.directory_category_selected': 'Integrations: Directory Category Selected',
  102. 'integrations.serverless_functions_viewed': 'Integrations: Serverless Functions Viewed',
  103. 'integrations.installation_input_value_changed':
  104. 'Integrations: Installation Input Value Changed',
  105. 'integrations.serverless_function_action': 'Integrations: Serverless Function Action',
  106. 'integrations.cloudformation_link_clicked': 'Integrations: CloudFormation Link Clicked',
  107. 'integrations.switch_manual_sdk_setup': 'Integrations: Switch Manual SDK Setup',
  108. ...codeownersEventMap,
  109. ...stacktraceLinkEventMap,
  110. ...platformEventMap,
  111. };