group.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  1. import type {LocationDescriptor} from 'history';
  2. import type {TitledPlugin} from 'sentry/components/group/pluginActions';
  3. import type {SearchGroup} from 'sentry/components/smartSearchBar/types';
  4. import type {FieldKind} from 'sentry/utils/fields';
  5. import type {Actor, TimeseriesValue} from './core';
  6. import type {Event, EventMetadata, EventOrGroupType, Level} from './event';
  7. import type {
  8. Commit,
  9. ExternalIssue,
  10. PlatformExternalIssue,
  11. PullRequest,
  12. Repository,
  13. } from './integrations';
  14. import type {Team} from './organization';
  15. import type {PlatformKey, Project} from './project';
  16. import type {AvatarUser, User} from './user';
  17. export type EntryData = Record<string, any | Array<any>>;
  18. /**
  19. * Saved issues searches
  20. */
  21. export type RecentSearch = {
  22. dateCreated: string;
  23. id: string;
  24. lastSeen: string;
  25. organizationId: string;
  26. query: string;
  27. type: SavedSearchType;
  28. };
  29. // XXX: Deprecated Sentry 9 attributes are not included here.
  30. export type SavedSearch = {
  31. dateCreated: string;
  32. id: string;
  33. isGlobal: boolean;
  34. isPinned: boolean;
  35. name: string;
  36. query: string;
  37. sort: string;
  38. type: SavedSearchType;
  39. visibility: SavedSearchVisibility;
  40. };
  41. export enum SavedSearchVisibility {
  42. ORGANIZATION = 'organization',
  43. OWNER = 'owner',
  44. OWNER_PINNED = 'owner_pinned',
  45. }
  46. export enum SavedSearchType {
  47. ISSUE = 0,
  48. EVENT = 1,
  49. SESSION = 2,
  50. REPLAY = 3,
  51. METRIC = 4,
  52. }
  53. export enum IssueCategory {
  54. PERFORMANCE = 'performance',
  55. ERROR = 'error',
  56. CRON = 'cron',
  57. PROFILE = 'profile',
  58. REPLAY = 'replay',
  59. }
  60. export enum IssueType {
  61. // Error
  62. ERROR = 'error',
  63. // Performance
  64. PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'performance_consecutive_db_queries',
  65. PERFORMANCE_CONSECUTIVE_HTTP = 'performance_consecutive_http',
  66. PERFORMANCE_FILE_IO_MAIN_THREAD = 'performance_file_io_main_thread',
  67. PERFORMANCE_DB_MAIN_THREAD = 'performance_db_main_thread',
  68. PERFORMANCE_N_PLUS_ONE_API_CALLS = 'performance_n_plus_one_api_calls',
  69. PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 'performance_n_plus_one_db_queries',
  70. PERFORMANCE_SLOW_DB_QUERY = 'performance_slow_db_query',
  71. PERFORMANCE_RENDER_BLOCKING_ASSET = 'performance_render_blocking_asset_span',
  72. PERFORMANCE_UNCOMPRESSED_ASSET = 'performance_uncompressed_assets',
  73. PERFORMANCE_LARGE_HTTP_PAYLOAD = 'performance_large_http_payload',
  74. PERFORMANCE_HTTP_OVERHEAD = 'performance_http_overhead',
  75. PERFORMANCE_DURATION_REGRESSION = 'performance_duration_regression',
  76. PERFORMANCE_ENDPOINT_REGRESSION = 'performance_p95_endpoint_regression',
  77. // Profile
  78. PROFILE_FILE_IO_MAIN_THREAD = 'profile_file_io_main_thread',
  79. PROFILE_IMAGE_DECODE_MAIN_THREAD = 'profile_image_decode_main_thread',
  80. PROFILE_JSON_DECODE_MAIN_THREAD = 'profile_json_decode_main_thread',
  81. PROFILE_REGEX_MAIN_THREAD = 'profile_regex_main_thread',
  82. PROFILE_FRAME_DROP = 'profile_frame_drop',
  83. PROFILE_FRAME_DROP_EXPERIMENTAL = 'profile_frame_drop_experimental',
  84. PROFILE_FUNCTION_REGRESSION = 'profile_function_regression',
  85. PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL = 'profile_function_regression_exp',
  86. // Replay
  87. REPLAY_RAGE_CLICK = 'replay_click_rage',
  88. }
  89. export enum IssueTitle {
  90. // Performance
  91. PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'Consecutive DB Queries',
  92. PERFORMANCE_CONSECUTIVE_HTTP = 'Consecutive HTTP',
  93. PERFORMANCE_FILE_IO_MAIN_THREAD = 'File IO on Main Thread',
  94. PERFORMANCE_DB_MAIN_THREAD = 'DB on Main Thread',
  95. PERFORMANCE_N_PLUS_ONE_API_CALLS = 'N+1 API Call',
  96. PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 'N+1 Query',
  97. PERFORMANCE_SLOW_DB_QUERY = 'Slow DB Query',
  98. PERFORMANCE_RENDER_BLOCKING_ASSET = 'Large Render Blocking Asset',
  99. PERFORMANCE_UNCOMPRESSED_ASSET = 'Uncompressed Asset',
  100. PERFORMANCE_LARGE_HTTP_PAYLOAD = 'Large HTTP payload',
  101. PERFORMANCE_HTTP_OVERHEAD = 'HTTP/1.1 Overhead',
  102. PERFORMANCE_DURATION_REGRESSION = 'Duration Regression',
  103. PERFORMANCE_ENDPOINT_REGRESSION = 'Endpoint Regression',
  104. // Profile
  105. PROFILE_FILE_IO_MAIN_THREAD = 'File I/O on Main Thread',
  106. PROFILE_IMAGE_DECODE_MAIN_THREAD = 'Image Decoding on Main Thread',
  107. PROFILE_JSON_DECODE_MAIN_THREAD = 'JSON Decoding on Main Thread',
  108. PROFILE_REGEX_MAIN_THREAD = 'Regex on Main Thread',
  109. PROFILE_FRAME_DROP = 'Frame Drop',
  110. PROFILE_FRAME_DROP_EXPERIMENTAL = 'Frame Drop',
  111. PROFILE_FUNCTION_REGRESSION = 'Function Regression',
  112. PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL = 'Function Duration Regression (Experimental)',
  113. // Replay
  114. REPLAY_RAGE_CLICK = 'Rage Click Detected',
  115. }
  116. const ISSUE_TYPE_TO_ISSUE_TITLE = {
  117. performance_consecutive_db_queries: IssueTitle.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
  118. performance_consecutive_http: IssueTitle.PERFORMANCE_CONSECUTIVE_HTTP,
  119. performance_file_io_main_thread: IssueTitle.PERFORMANCE_FILE_IO_MAIN_THREAD,
  120. performance_db_main_thread: IssueTitle.PERFORMANCE_DB_MAIN_THREAD,
  121. performance_n_plus_one_api_calls: IssueTitle.PERFORMANCE_N_PLUS_ONE_API_CALLS,
  122. performance_n_plus_one_db_queries: IssueTitle.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
  123. performance_slow_db_query: IssueTitle.PERFORMANCE_SLOW_DB_QUERY,
  124. performance_render_blocking_asset_span: IssueTitle.PERFORMANCE_RENDER_BLOCKING_ASSET,
  125. performance_uncompressed_assets: IssueTitle.PERFORMANCE_UNCOMPRESSED_ASSET,
  126. performance_large_http_payload: IssueTitle.PERFORMANCE_LARGE_HTTP_PAYLOAD,
  127. performance_http_overhead: IssueTitle.PERFORMANCE_HTTP_OVERHEAD,
  128. performance_duration_regression: IssueTitle.PERFORMANCE_DURATION_REGRESSION,
  129. performance_p95_endpoint_regression: IssueTitle.PERFORMANCE_ENDPOINT_REGRESSION,
  130. profile_file_io_main_thread: IssueTitle.PROFILE_FILE_IO_MAIN_THREAD,
  131. profile_image_decode_main_thread: IssueTitle.PROFILE_IMAGE_DECODE_MAIN_THREAD,
  132. profile_json_decode_main_thread: IssueTitle.PROFILE_JSON_DECODE_MAIN_THREAD,
  133. profile_regex_main_thread: IssueTitle.PROFILE_REGEX_MAIN_THREAD,
  134. profile_frame_drop: IssueTitle.PROFILE_FRAME_DROP,
  135. profile_frame_drop_experimental: IssueTitle.PROFILE_FRAME_DROP_EXPERIMENTAL,
  136. profile_function_regression: IssueTitle.PROFILE_FUNCTION_REGRESSION,
  137. profile_function_regression_exp: IssueTitle.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL,
  138. replay_click_rage: IssueTitle.REPLAY_RAGE_CLICK,
  139. };
  140. export function getIssueTitleFromType(issueType: string): IssueTitle | undefined {
  141. if (issueType in ISSUE_TYPE_TO_ISSUE_TITLE) {
  142. return ISSUE_TYPE_TO_ISSUE_TITLE[issueType];
  143. }
  144. return undefined;
  145. }
  146. const OCCURRENCE_TYPE_TO_ISSUE_TYPE = {
  147. 1001: IssueType.PERFORMANCE_SLOW_DB_QUERY,
  148. 1004: IssueType.PERFORMANCE_RENDER_BLOCKING_ASSET,
  149. 1006: IssueType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
  150. 1007: IssueType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
  151. 1008: IssueType.PERFORMANCE_FILE_IO_MAIN_THREAD,
  152. 1009: IssueType.PERFORMANCE_CONSECUTIVE_HTTP,
  153. 1010: IssueType.PERFORMANCE_N_PLUS_ONE_API_CALLS,
  154. 1012: IssueType.PERFORMANCE_UNCOMPRESSED_ASSET,
  155. 1013: IssueType.PERFORMANCE_DB_MAIN_THREAD,
  156. 1015: IssueType.PERFORMANCE_LARGE_HTTP_PAYLOAD,
  157. 1016: IssueType.PERFORMANCE_HTTP_OVERHEAD,
  158. 1017: IssueType.PERFORMANCE_DURATION_REGRESSION,
  159. 1018: IssueType.PERFORMANCE_ENDPOINT_REGRESSION,
  160. 2001: IssueType.PROFILE_FILE_IO_MAIN_THREAD,
  161. 2002: IssueType.PROFILE_IMAGE_DECODE_MAIN_THREAD,
  162. 2003: IssueType.PROFILE_JSON_DECODE_MAIN_THREAD,
  163. 2007: IssueType.PROFILE_REGEX_MAIN_THREAD,
  164. 2008: IssueType.PROFILE_FRAME_DROP,
  165. 2009: IssueType.PROFILE_FRAME_DROP_EXPERIMENTAL,
  166. 2010: IssueType.PROFILE_FUNCTION_REGRESSION,
  167. 2011: IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL,
  168. };
  169. const PERFORMANCE_REGRESSION_TYPE_IDS = new Set([1017, 1018, 2010, 2011]);
  170. export function getIssueTypeFromOccurrenceType(
  171. typeId: number | undefined
  172. ): IssueType | null {
  173. if (!typeId) {
  174. return null;
  175. }
  176. return OCCURRENCE_TYPE_TO_ISSUE_TYPE[typeId] ?? null;
  177. }
  178. export function isTransactionBased(typeId: number | undefined): boolean {
  179. if (!typeId) {
  180. return false;
  181. }
  182. // the 1xxx type ids are transaction based performance issues
  183. return typeId >= 1000 && typeId < 2000;
  184. }
  185. export function isOccurrenceBased(typeId: number | undefined): boolean {
  186. if (!typeId) {
  187. return false;
  188. }
  189. // these are regression type performance issues
  190. return !PERFORMANCE_REGRESSION_TYPE_IDS.has(typeId);
  191. }
  192. // endpoint: /api/0/issues/:issueId/attachments/?limit=50
  193. export type IssueAttachment = {
  194. dateCreated: string;
  195. event_id: string;
  196. headers: object;
  197. id: string;
  198. mimetype: string;
  199. name: string;
  200. sha1: string;
  201. size: number;
  202. type: string;
  203. };
  204. // endpoint: /api/0/projects/:orgSlug/:projSlug/events/:eventId/attachments/
  205. export type EventAttachment = IssueAttachment;
  206. /**
  207. * Issue Tags
  208. */
  209. export type Tag = {
  210. key: string;
  211. name: string;
  212. isInput?: boolean;
  213. kind?: FieldKind;
  214. /**
  215. * How many values should be suggested in autocomplete.
  216. * Overrides SmartSearchBar's `maxSearchItems` prop.
  217. */
  218. maxSuggestedValues?: number;
  219. predefined?: boolean;
  220. totalValues?: number;
  221. /**
  222. * Usually values are strings, but a predefined tag can define its SearchGroups
  223. */
  224. values?: string[] | SearchGroup[];
  225. };
  226. export type TagCollection = Record<string, Tag>;
  227. export type TagValue = {
  228. count: number;
  229. firstSeen: string;
  230. lastSeen: string;
  231. name: string;
  232. value: string;
  233. email?: string;
  234. identifier?: string;
  235. ipAddress?: string;
  236. key?: string;
  237. query?: string;
  238. username?: string;
  239. } & AvatarUser;
  240. type Topvalue = {
  241. count: number;
  242. firstSeen: string;
  243. key: string;
  244. lastSeen: string;
  245. name: string;
  246. value: string;
  247. // Might not actually exist.
  248. query?: string;
  249. readable?: string;
  250. };
  251. export type TagWithTopValues = {
  252. key: string;
  253. name: string;
  254. topValues: Array<Topvalue>;
  255. totalValues: number;
  256. uniqueValues: number;
  257. canDelete?: boolean;
  258. };
  259. /**
  260. * Inbox, issue owners and Activity
  261. */
  262. export type InboxReasonDetails = {
  263. count?: number | null;
  264. until?: string | null;
  265. user_count?: number | null;
  266. user_window?: number | null;
  267. window?: number | null;
  268. };
  269. export const enum GroupInboxReason {
  270. NEW = 0,
  271. UNIGNORED = 1,
  272. REGRESSION = 2,
  273. MANUAL = 3,
  274. REPROCESSED = 4,
  275. ESCALATING = 5,
  276. ONGOING = 6,
  277. }
  278. export type InboxDetails = {
  279. date_added?: string;
  280. reason?: GroupInboxReason;
  281. reason_details?: InboxReasonDetails | null;
  282. };
  283. export type SuggestedOwnerReason =
  284. | 'suspectCommit'
  285. | 'ownershipRule'
  286. | 'projectOwnership'
  287. // TODO: codeowners may no longer exist
  288. | 'codeowners';
  289. // Received from the backend to denote suggested owners of an issue
  290. export type SuggestedOwner = {
  291. date_added: string;
  292. owner: string;
  293. type: SuggestedOwnerReason;
  294. };
  295. export interface ParsedOwnershipRule {
  296. matcher: {pattern: string; type: string};
  297. owners: Actor[];
  298. }
  299. export type IssueOwnership = {
  300. autoAssignment:
  301. | 'Auto Assign to Suspect Commits'
  302. | 'Auto Assign to Issue Owner'
  303. | 'Turn off Auto-Assignment';
  304. codeownersAutoSync: boolean;
  305. dateCreated: string | null;
  306. fallthrough: boolean;
  307. isActive: boolean;
  308. lastUpdated: string | null;
  309. raw: string | null;
  310. schema?: {rules: ParsedOwnershipRule[]; version: number};
  311. };
  312. export enum GroupActivityType {
  313. NOTE = 'note',
  314. SET_RESOLVED = 'set_resolved',
  315. SET_RESOLVED_BY_AGE = 'set_resolved_by_age',
  316. SET_RESOLVED_IN_RELEASE = 'set_resolved_in_release',
  317. SET_RESOLVED_IN_COMMIT = 'set_resolved_in_commit',
  318. SET_RESOLVED_IN_PULL_REQUEST = 'set_resolved_in_pull_request',
  319. SET_UNRESOLVED = 'set_unresolved',
  320. SET_IGNORED = 'set_ignored',
  321. SET_PUBLIC = 'set_public',
  322. SET_PRIVATE = 'set_private',
  323. SET_REGRESSION = 'set_regression',
  324. CREATE_ISSUE = 'create_issue',
  325. UNMERGE_SOURCE = 'unmerge_source',
  326. UNMERGE_DESTINATION = 'unmerge_destination',
  327. FIRST_SEEN = 'first_seen',
  328. ASSIGNED = 'assigned',
  329. UNASSIGNED = 'unassigned',
  330. MERGE = 'merge',
  331. REPROCESS = 'reprocess',
  332. MARK_REVIEWED = 'mark_reviewed',
  333. AUTO_SET_ONGOING = 'auto_set_ongoing',
  334. SET_ESCALATING = 'set_escalating',
  335. SET_PRIORITY = 'set_priority',
  336. DELETED_ATTACHMENT = 'deleted_attachment',
  337. }
  338. interface GroupActivityBase {
  339. dateCreated: string;
  340. id: string;
  341. project: Project;
  342. assignee?: string;
  343. issue?: Group;
  344. user?: null | User;
  345. }
  346. export interface GroupActivityNote extends GroupActivityBase {
  347. data: {
  348. text: string;
  349. };
  350. type: GroupActivityType.NOTE;
  351. }
  352. interface GroupActivitySetResolved extends GroupActivityBase {
  353. data: {};
  354. type: GroupActivityType.SET_RESOLVED;
  355. }
  356. /**
  357. * An integration marks an issue as resolved
  358. */
  359. interface GroupActivitySetResolvedIntegration extends GroupActivityBase {
  360. data: {
  361. integration_id: number;
  362. /**
  363. * Human readable name of the integration
  364. */
  365. provider: string;
  366. /**
  367. * The key of the integration
  368. */
  369. provider_key: string;
  370. };
  371. type: GroupActivityType.SET_RESOLVED;
  372. }
  373. interface GroupActivitySetUnresolved extends GroupActivityBase {
  374. data: {};
  375. type: GroupActivityType.SET_UNRESOLVED;
  376. }
  377. interface GroupActivitySetUnresolvedForecast extends GroupActivityBase {
  378. data: {
  379. forecast: number;
  380. };
  381. type: GroupActivityType.SET_UNRESOLVED;
  382. }
  383. /**
  384. * An integration marks an issue as unresolved
  385. */
  386. interface GroupActivitySetUnresolvedIntegration extends GroupActivityBase {
  387. data: {
  388. integration_id: number;
  389. /**
  390. * Human readable name of the integration
  391. */
  392. provider: string;
  393. /**
  394. * The key of the integration
  395. */
  396. provider_key: string;
  397. };
  398. type: GroupActivityType.SET_UNRESOLVED;
  399. }
  400. interface GroupActivitySetPublic extends GroupActivityBase {
  401. data: Record<string, any>;
  402. type: GroupActivityType.SET_PUBLIC;
  403. }
  404. interface GroupActivitySetPrivate extends GroupActivityBase {
  405. data: Record<string, any>;
  406. type: GroupActivityType.SET_PRIVATE;
  407. }
  408. interface GroupActivitySetByAge extends GroupActivityBase {
  409. data: Record<string, any>;
  410. type: GroupActivityType.SET_RESOLVED_BY_AGE;
  411. }
  412. interface GroupActivityUnassigned extends GroupActivityBase {
  413. data: Record<string, any>;
  414. type: GroupActivityType.UNASSIGNED;
  415. }
  416. interface GroupActivityFirstSeen extends GroupActivityBase {
  417. data: Record<string, any>;
  418. type: GroupActivityType.FIRST_SEEN;
  419. }
  420. interface GroupActivityMarkReviewed extends GroupActivityBase {
  421. data: Record<string, any>;
  422. type: GroupActivityType.MARK_REVIEWED;
  423. }
  424. interface GroupActivityRegression extends GroupActivityBase {
  425. data: {
  426. /**
  427. * True if the project is using semver to decide if the event is a regression.
  428. * Available when the issue was resolved in a release.
  429. */
  430. follows_semver?: boolean;
  431. /**
  432. * The version that the issue was previously resolved in.
  433. * Available when the issue was resolved in a release.
  434. */
  435. resolved_in_version?: string;
  436. version?: string;
  437. };
  438. type: GroupActivityType.SET_REGRESSION;
  439. }
  440. export interface GroupActivitySetByResolvedInNextSemverRelease extends GroupActivityBase {
  441. data: {
  442. // Set for semver releases
  443. current_release_version: string;
  444. };
  445. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  446. }
  447. export interface GroupActivitySetByResolvedInRelease extends GroupActivityBase {
  448. data: {
  449. version?: string;
  450. };
  451. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  452. }
  453. interface GroupActivitySetByResolvedInCommit extends GroupActivityBase {
  454. data: {
  455. commit?: Commit;
  456. };
  457. type: GroupActivityType.SET_RESOLVED_IN_COMMIT;
  458. }
  459. interface GroupActivitySetByResolvedInPullRequest extends GroupActivityBase {
  460. data: {
  461. pullRequest?: PullRequest;
  462. };
  463. type: GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST;
  464. }
  465. export interface GroupActivitySetIgnored extends GroupActivityBase {
  466. data: {
  467. ignoreCount?: number;
  468. ignoreDuration?: number;
  469. ignoreUntil?: string;
  470. /** Archived until escalating */
  471. ignoreUntilEscalating?: boolean;
  472. ignoreUserCount?: number;
  473. ignoreUserWindow?: number;
  474. ignoreWindow?: number;
  475. };
  476. type: GroupActivityType.SET_IGNORED;
  477. }
  478. export interface GroupActivityReprocess extends GroupActivityBase {
  479. data: {
  480. eventCount: number;
  481. newGroupId: number;
  482. oldGroupId: number;
  483. };
  484. type: GroupActivityType.REPROCESS;
  485. }
  486. interface GroupActivityUnmergeDestination extends GroupActivityBase {
  487. data: {
  488. fingerprints: Array<string>;
  489. source?: {
  490. id: string;
  491. shortId: string;
  492. };
  493. };
  494. type: GroupActivityType.UNMERGE_DESTINATION;
  495. }
  496. interface GroupActivityUnmergeSource extends GroupActivityBase {
  497. data: {
  498. fingerprints: Array<string>;
  499. destination?: {
  500. id: string;
  501. shortId: string;
  502. };
  503. };
  504. type: GroupActivityType.UNMERGE_SOURCE;
  505. }
  506. interface GroupActivityMerge extends GroupActivityBase {
  507. data: {
  508. issues: Array<any>;
  509. };
  510. type: GroupActivityType.MERGE;
  511. }
  512. interface GroupActivityAutoSetOngoing extends GroupActivityBase {
  513. data: {
  514. afterDays?: number;
  515. };
  516. type: GroupActivityType.AUTO_SET_ONGOING;
  517. }
  518. export interface GroupActivitySetEscalating extends GroupActivityBase {
  519. data: {
  520. expired_snooze?: {
  521. count: number | null;
  522. until: Date | null;
  523. user_count: number | null;
  524. user_window: number | null;
  525. window: number | null;
  526. };
  527. forecast?: number;
  528. };
  529. type: GroupActivityType.SET_ESCALATING;
  530. }
  531. export interface GroupActivitySetPriority extends GroupActivityBase {
  532. data: {
  533. priority: PriorityLevel;
  534. reason: string;
  535. };
  536. type: GroupActivityType.SET_PRIORITY;
  537. }
  538. export interface GroupActivityAssigned extends GroupActivityBase {
  539. data: {
  540. assignee: string;
  541. assigneeType: string;
  542. user: Team | User;
  543. assigneeEmail?: string;
  544. /**
  545. * If the user was assigned via an integration
  546. */
  547. integration?:
  548. | 'projectOwnership'
  549. | 'codeowners'
  550. | 'slack'
  551. | 'msteams'
  552. | 'suspectCommitter';
  553. /** Codeowner or Project owner rule as a string */
  554. rule?: string;
  555. };
  556. type: GroupActivityType.ASSIGNED;
  557. }
  558. export interface GroupActivityCreateIssue extends GroupActivityBase {
  559. data: {
  560. location: string;
  561. provider: string;
  562. title: string;
  563. };
  564. type: GroupActivityType.CREATE_ISSUE;
  565. }
  566. interface GroupActivityDeletedAttachment extends GroupActivityBase {
  567. data: {};
  568. type: GroupActivityType.DELETED_ATTACHMENT;
  569. }
  570. export type GroupActivity =
  571. | GroupActivityNote
  572. | GroupActivitySetResolved
  573. | GroupActivitySetResolvedIntegration
  574. | GroupActivitySetUnresolved
  575. | GroupActivitySetUnresolvedForecast
  576. | GroupActivitySetUnresolvedIntegration
  577. | GroupActivitySetIgnored
  578. | GroupActivitySetByAge
  579. | GroupActivitySetByResolvedInRelease
  580. | GroupActivitySetByResolvedInNextSemverRelease
  581. | GroupActivitySetByResolvedInCommit
  582. | GroupActivitySetByResolvedInPullRequest
  583. | GroupActivityFirstSeen
  584. | GroupActivityMerge
  585. | GroupActivityReprocess
  586. | GroupActivityUnassigned
  587. | GroupActivityMarkReviewed
  588. | GroupActivityUnmergeDestination
  589. | GroupActivitySetPublic
  590. | GroupActivitySetPrivate
  591. | GroupActivityRegression
  592. | GroupActivityUnmergeSource
  593. | GroupActivityAssigned
  594. | GroupActivityCreateIssue
  595. | GroupActivityAutoSetOngoing
  596. | GroupActivitySetEscalating
  597. | GroupActivitySetPriority
  598. | GroupActivityDeletedAttachment;
  599. export type Activity = GroupActivity;
  600. interface GroupFiltered {
  601. count: string;
  602. firstSeen: string;
  603. lastSeen: string;
  604. stats: Record<string, TimeseriesValue[]>;
  605. userCount: number;
  606. }
  607. export interface GroupStats extends GroupFiltered {
  608. filtered: GroupFiltered | null;
  609. id: string;
  610. isUnhandled?: boolean;
  611. // for issue alert previews, the last time a group triggered a rule
  612. lastTriggered?: string;
  613. lifetime?: GroupFiltered;
  614. sessionCount?: string | null;
  615. }
  616. export interface IgnoredStatusDetails {
  617. actor?: AvatarUser;
  618. ignoreCount?: number;
  619. // Sent in requests. ignoreUntil is used in responses.
  620. ignoreDuration?: number;
  621. ignoreUntil?: string;
  622. ignoreUntilEscalating?: boolean;
  623. ignoreUserCount?: number;
  624. ignoreUserWindow?: number;
  625. ignoreWindow?: number;
  626. }
  627. export interface ResolvedStatusDetails {
  628. actor?: AvatarUser;
  629. autoResolved?: boolean;
  630. inCommit?: {
  631. commit?: string;
  632. dateCreated?: string;
  633. id?: string;
  634. repository?: string | Repository;
  635. };
  636. inNextRelease?: boolean;
  637. inRelease?: string;
  638. repository?: string;
  639. }
  640. interface ReprocessingStatusDetails {
  641. info: {
  642. dateCreated: string;
  643. totalEvents: number;
  644. } | null;
  645. pendingEvents: number;
  646. }
  647. export interface UserParticipant extends User {
  648. type: 'user';
  649. }
  650. export interface TeamParticipant extends Team {
  651. type: 'team';
  652. }
  653. /**
  654. * The payload sent when marking reviewed
  655. */
  656. export interface MarkReviewed {
  657. inbox: false;
  658. }
  659. /**
  660. * The payload sent when updating a group's status
  661. */
  662. export interface GroupStatusResolution {
  663. status: GroupStatus.RESOLVED | GroupStatus.UNRESOLVED | GroupStatus.IGNORED;
  664. statusDetails: ResolvedStatusDetails | IgnoredStatusDetails | {};
  665. substatus?: GroupSubstatus | null;
  666. }
  667. export const enum GroupStatus {
  668. RESOLVED = 'resolved',
  669. UNRESOLVED = 'unresolved',
  670. IGNORED = 'ignored',
  671. REPROCESSING = 'reprocessing',
  672. }
  673. export const enum GroupSubstatus {
  674. ARCHIVED_UNTIL_ESCALATING = 'archived_until_escalating',
  675. ARCHIVED_UNTIL_CONDITION_MET = 'archived_until_condition_met',
  676. ARCHIVED_FOREVER = 'archived_forever',
  677. ESCALATING = 'escalating',
  678. ONGOING = 'ongoing',
  679. REGRESSED = 'regressed',
  680. NEW = 'new',
  681. }
  682. export const enum PriorityLevel {
  683. HIGH = 'high',
  684. MEDIUM = 'medium',
  685. LOW = 'low',
  686. }
  687. // TODO(ts): incomplete
  688. export interface BaseGroup {
  689. activity: GroupActivity[];
  690. annotations: string[];
  691. assignedTo: Actor | null;
  692. culprit: string;
  693. firstSeen: string;
  694. hasSeen: boolean;
  695. id: string;
  696. isBookmarked: boolean;
  697. isPublic: boolean;
  698. isSubscribed: boolean;
  699. issueCategory: IssueCategory;
  700. issueType: IssueType;
  701. lastSeen: string;
  702. level: Level;
  703. logger: string | null;
  704. metadata: EventMetadata;
  705. numComments: number;
  706. participants: Array<UserParticipant | TeamParticipant>;
  707. permalink: string;
  708. platform: PlatformKey;
  709. pluginActions: TitledPlugin[];
  710. pluginContexts: any[]; // TODO(ts)
  711. pluginIssues: TitledPlugin[];
  712. priority: PriorityLevel;
  713. priorityLockedAt: string | null;
  714. project: Project;
  715. seenBy: User[];
  716. shareId: string;
  717. shortId: string;
  718. status: GroupStatus;
  719. statusDetails: IgnoredStatusDetails | ResolvedStatusDetails | ReprocessingStatusDetails;
  720. subscriptionDetails: {disabled?: boolean; reason?: string} | null;
  721. title: string;
  722. type: EventOrGroupType;
  723. userReportCount: number;
  724. inbox?: InboxDetails | null | false;
  725. integrationIssues?: ExternalIssue[];
  726. latestEvent?: Event;
  727. latestEventHasAttachments?: boolean;
  728. owners?: SuggestedOwner[] | null;
  729. sentryAppIssues?: PlatformExternalIssue[];
  730. substatus?: GroupSubstatus | null;
  731. }
  732. export interface GroupReprocessing extends BaseGroup, GroupStats {
  733. status: GroupStatus.REPROCESSING;
  734. statusDetails: ReprocessingStatusDetails;
  735. }
  736. export interface GroupResolved extends BaseGroup, GroupStats {
  737. status: GroupStatus.RESOLVED;
  738. statusDetails: ResolvedStatusDetails;
  739. }
  740. export interface GroupIgnored extends BaseGroup, GroupStats {
  741. status: GroupStatus.IGNORED;
  742. statusDetails: IgnoredStatusDetails;
  743. }
  744. export interface GroupUnresolved extends BaseGroup, GroupStats {
  745. status: GroupStatus.UNRESOLVED;
  746. statusDetails: {};
  747. }
  748. export type Group = GroupUnresolved | GroupResolved | GroupIgnored | GroupReprocessing;
  749. export interface GroupTombstone {
  750. actor: AvatarUser;
  751. culprit: string;
  752. id: string;
  753. level: Level;
  754. metadata: EventMetadata;
  755. type: EventOrGroupType;
  756. title?: string;
  757. }
  758. export interface GroupTombstoneHelper extends GroupTombstone {
  759. isTombstone: true;
  760. }
  761. export type ProcessingIssueItem = {
  762. checksum: string;
  763. data: {
  764. // TODO(ts) This type is likely incomplete, but this is what
  765. // project processing issues settings uses.
  766. _scope: string;
  767. image_arch: string;
  768. image_path: string;
  769. image_uuid: string;
  770. dist?: string;
  771. release?: string;
  772. };
  773. id: string;
  774. lastSeen: string;
  775. numEvents: number;
  776. type: string;
  777. };
  778. export type ProcessingIssue = {
  779. hasIssues: boolean;
  780. hasMoreResolveableIssues: boolean;
  781. issuesProcessing: number;
  782. lastSeen: string;
  783. numIssues: number;
  784. project: string;
  785. resolveableIssues: number;
  786. signedLink: string;
  787. issues?: ProcessingIssueItem[];
  788. };
  789. /**
  790. * Datascrubbing
  791. */
  792. export type Meta = {
  793. chunks: Array<ChunkType>;
  794. err: Array<MetaError>;
  795. len: number;
  796. rem: Array<MetaRemark>;
  797. };
  798. export type MetaError = string | [string, any];
  799. export type MetaRemark = Array<string | number>;
  800. export type ChunkType = {
  801. rule_id: string | number;
  802. text: string;
  803. type: string;
  804. remark?: string | number;
  805. };
  806. /**
  807. * Old User Feedback
  808. */
  809. export type UserReport = {
  810. comments: string;
  811. dateCreated: string;
  812. email: string;
  813. event: {eventID: string; id: string};
  814. eventID: string;
  815. id: string;
  816. issue: Group;
  817. name: string;
  818. user: User;
  819. };
  820. export type KeyValueListDataItem = {
  821. key: string;
  822. subject: string;
  823. action?: {
  824. link?: string | LocationDescriptor;
  825. };
  826. actionButton?: React.ReactNode;
  827. isContextData?: boolean;
  828. isMultiValue?: boolean;
  829. meta?: Meta;
  830. subjectDataTestId?: string;
  831. subjectIcon?: React.ReactNode;
  832. subjectNode?: React.ReactNode;
  833. value?: React.ReactNode | Record<string, string | number>;
  834. };
  835. export type KeyValueListData = KeyValueListDataItem[];
  836. // Response from ShortIdLookupEndpoint
  837. // /organizations/${orgId}/shortids/${query}/
  838. export type ShortIdResponse = {
  839. group: Group;
  840. groupId: string;
  841. organizationSlug: string;
  842. projectSlug: string;
  843. shortId: string;
  844. };
  845. /**
  846. * Note used in Group Activity and Alerts for users to comment
  847. */
  848. export type Note = {
  849. /**
  850. * Array of [id, display string] tuples used for @-mentions
  851. */
  852. mentions: [string, string][];
  853. /**
  854. * Note contents (markdown allowed)
  855. */
  856. text: string;
  857. };