workflowAnalyticsEvents.tsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import type {IssueCategory, ResolutionStatus} from 'sentry/types';
  2. import {Tab} from 'sentry/views/organizationGroupDetails/types';
  3. type RuleViewed = {
  4. alert_type: 'issue' | 'metric';
  5. project_id: string;
  6. };
  7. type IssueDetailsWithAlert = {
  8. group_id: number;
  9. issue_category: IssueCategory;
  10. project_id: number;
  11. /** The time that the alert was initially fired. */
  12. alert_date?: string;
  13. /** Id of the rule that triggered the alert */
  14. alert_rule_id?: string;
  15. /** The type of alert notification - email/slack */
  16. alert_type?: string;
  17. };
  18. export type BaseEventAnalyticsParams = {
  19. event_id: string;
  20. has_commit: boolean;
  21. has_release: boolean;
  22. has_source_maps: boolean;
  23. has_trace: boolean;
  24. num_commits: number;
  25. num_in_app_stack_frames: number;
  26. num_stack_frames: number;
  27. num_threads_with_names: number;
  28. event_platform?: string;
  29. event_type?: string;
  30. sdk_name?: string;
  31. sdk_version?: string;
  32. };
  33. export type TeamInsightsEventParameters = {
  34. 'alert_builder.filter': {query: string; session_id?: string};
  35. 'alert_details.viewed': {alert_id: number};
  36. 'alert_rule_details.viewed': {alert: string; has_chartcuterie: string; rule_id: number};
  37. 'alert_rules.viewed': {sort: string};
  38. 'alert_stream.viewed': {};
  39. 'alert_wizard.option_selected': {alert_type: string};
  40. 'alert_wizard.option_viewed': {alert_type: string};
  41. 'edit_alert_rule.add_row': {
  42. name: string;
  43. project_id: string;
  44. type: string;
  45. };
  46. 'edit_alert_rule.viewed': RuleViewed;
  47. 'issue_alert_rule_details.edit_clicked': {rule_id: number};
  48. 'issue_alert_rule_details.viewed': {rule_id: number};
  49. 'issue_details.action_clicked': IssueDetailsWithAlert & {
  50. action_type:
  51. | 'deleted'
  52. | 'mark_reviewed'
  53. | 'bookmarked'
  54. | 'subscribed'
  55. | 'shared'
  56. | 'discarded'
  57. | 'open_in_discover'
  58. | 'assign'
  59. | ResolutionStatus;
  60. assigned_suggestion_reason?: string;
  61. };
  62. 'issue_details.attachment_tab.screenshot_modal_deleted': {};
  63. 'issue_details.attachment_tab.screenshot_modal_download': {};
  64. 'issue_details.attachment_tab.screenshot_modal_opened': {};
  65. 'issue_details.attachment_tab.screenshot_title_clicked': {};
  66. 'issue_details.event_json_clicked': {group_id: number};
  67. 'issue_details.event_navigation_clicked': {button: string; project_id: number};
  68. 'issue_details.issue_tab.screenshot_dropdown_deleted': {};
  69. 'issue_details.issue_tab.screenshot_dropdown_download': {};
  70. 'issue_details.issue_tab.screenshot_modal_deleted': {};
  71. 'issue_details.issue_tab.screenshot_modal_download': {};
  72. 'issue_details.issue_tab.screenshot_modal_opened': {};
  73. 'issue_details.suspect_commits': IssueDetailsWithAlert & {count: number};
  74. 'issue_details.suspect_commits.commit_clicked': IssueDetailsWithAlert;
  75. 'issue_details.suspect_commits.pull_request_clicked': IssueDetailsWithAlert;
  76. 'issue_details.tab_changed': IssueDetailsWithAlert & {
  77. tab: Tab;
  78. };
  79. 'issue_details.viewed': IssueDetailsWithAlert &
  80. BaseEventAnalyticsParams & {
  81. error_count: number;
  82. error_has_replay: boolean;
  83. event_errors: string;
  84. group_has_replay: boolean;
  85. has_owner: boolean;
  86. is_assigned: boolean;
  87. issue_age: number;
  88. num_comments: number;
  89. has_external_issue?: boolean;
  90. integration_assignment_source?: string;
  91. issue_level?: string;
  92. issue_status?: string;
  93. project_platform?: string;
  94. };
  95. 'new_alert_rule.viewed': RuleViewed & {
  96. duplicate_rule: string;
  97. session_id: string;
  98. wizard_v3: string;
  99. };
  100. 'project_creation_page.created': {
  101. issue_alert: 'Default' | 'Custom' | 'No Rule';
  102. project_id: string;
  103. rule_id: string;
  104. };
  105. 'project_creation_page.viewed': {};
  106. 'team_insights.viewed': {};
  107. };
  108. export type TeamInsightsEventKey = keyof TeamInsightsEventParameters;
  109. export const workflowEventMap: Record<TeamInsightsEventKey, string | null> = {
  110. 'alert_builder.filter': 'Alert Builder: Filter',
  111. 'alert_details.viewed': 'Alert Details: Viewed',
  112. 'alert_rule_details.viewed': 'Alert Rule Details: Viewed',
  113. 'alert_rules.viewed': 'Alert Rules: Viewed',
  114. 'alert_stream.viewed': 'Alert Stream: Viewed',
  115. 'alert_wizard.option_selected': 'Alert Wizard: Option Selected',
  116. 'alert_wizard.option_viewed': 'Alert Wizard: Option Viewed',
  117. 'edit_alert_rule.add_row': 'Edit Alert Rule: Add Row',
  118. 'edit_alert_rule.viewed': 'Edit Alert Rule: Viewed',
  119. 'issue_alert_rule_details.edit_clicked': 'Issue Alert Rule Details: Edit Clicked',
  120. 'issue_alert_rule_details.viewed': 'Issue Alert Rule Details: Viewed',
  121. 'issue_details.action_clicked': 'Issue Details: Action Clicked',
  122. 'issue_details.attachment_tab.screenshot_title_clicked':
  123. 'Attachment Tab: Screenshot title clicked',
  124. 'issue_details.attachment_tab.screenshot_modal_deleted':
  125. 'Attachment Tab: Screenshot deleted from modal',
  126. 'issue_details.attachment_tab.screenshot_modal_download':
  127. 'Attachment Tab: Screenshot downloaded from modal',
  128. 'issue_details.attachment_tab.screenshot_modal_opened':
  129. 'Attachment Tab: Screenshot modal opened',
  130. 'issue_details.event_json_clicked': 'Issue Details: Event JSON Clicked',
  131. 'issue_details.event_navigation_clicked': 'Issue Details: Event Navigation Clicked',
  132. 'issue_details.issue_tab.screenshot_dropdown_deleted':
  133. 'Issue Details: Screenshot deleted from dropdown',
  134. 'issue_details.issue_tab.screenshot_dropdown_download':
  135. 'Issue Details: Screenshot downloaded from dropdown',
  136. 'issue_details.issue_tab.screenshot_modal_deleted':
  137. 'Issue Details: Screenshot deleted from modal',
  138. 'issue_details.issue_tab.screenshot_modal_download':
  139. 'Issue Details: Screenshot downloaded from modal',
  140. 'issue_details.issue_tab.screenshot_modal_opened':
  141. 'Issue Details: Screenshot modal opened',
  142. 'issue_details.viewed': 'Issue Details: Viewed',
  143. 'issue_details.suspect_commits': 'Issue Details: Suspect Commits',
  144. 'issue_details.suspect_commits.commit_clicked': 'Issue Details: Suspect Commit Clicked',
  145. 'issue_details.suspect_commits.pull_request_clicked':
  146. 'Issue Details: Suspect Pull Request Clicked',
  147. 'issue_details.tab_changed': 'Issue Details: Tab Changed',
  148. 'new_alert_rule.viewed': 'New Alert Rule: Viewed',
  149. 'team_insights.viewed': 'Team Insights: Viewed',
  150. 'project_creation_page.viewed': 'Project Create: Creation page viewed',
  151. 'project_creation_page.created': 'Project Create: Project Created',
  152. };