group.tsx 25 KB

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