group.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  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. }
  337. interface GroupActivityBase {
  338. dateCreated: string;
  339. id: string;
  340. project: Project;
  341. assignee?: string;
  342. issue?: Group;
  343. user?: null | User;
  344. }
  345. export interface GroupActivityNote extends GroupActivityBase {
  346. data: {
  347. text: string;
  348. };
  349. type: GroupActivityType.NOTE;
  350. }
  351. interface GroupActivitySetResolved extends GroupActivityBase {
  352. data: {};
  353. type: GroupActivityType.SET_RESOLVED;
  354. }
  355. /**
  356. * An integration marks an issue as resolved
  357. */
  358. interface GroupActivitySetResolvedIntegration extends GroupActivityBase {
  359. data: {
  360. integration_id: number;
  361. /**
  362. * Human readable name of the integration
  363. */
  364. provider: string;
  365. /**
  366. * The key of the integration
  367. */
  368. provider_key: string;
  369. };
  370. type: GroupActivityType.SET_RESOLVED;
  371. }
  372. interface GroupActivitySetUnresolved extends GroupActivityBase {
  373. data: {};
  374. type: GroupActivityType.SET_UNRESOLVED;
  375. }
  376. interface GroupActivitySetUnresolvedForecast extends GroupActivityBase {
  377. data: {
  378. forecast: number;
  379. };
  380. type: GroupActivityType.SET_UNRESOLVED;
  381. }
  382. /**
  383. * An integration marks an issue as unresolved
  384. */
  385. interface GroupActivitySetUnresolvedIntegration extends GroupActivityBase {
  386. data: {
  387. integration_id: number;
  388. /**
  389. * Human readable name of the integration
  390. */
  391. provider: string;
  392. /**
  393. * The key of the integration
  394. */
  395. provider_key: string;
  396. };
  397. type: GroupActivityType.SET_UNRESOLVED;
  398. }
  399. interface GroupActivitySetPublic extends GroupActivityBase {
  400. data: Record<string, any>;
  401. type: GroupActivityType.SET_PUBLIC;
  402. }
  403. interface GroupActivitySetPrivate extends GroupActivityBase {
  404. data: Record<string, any>;
  405. type: GroupActivityType.SET_PRIVATE;
  406. }
  407. interface GroupActivitySetByAge extends GroupActivityBase {
  408. data: Record<string, any>;
  409. type: GroupActivityType.SET_RESOLVED_BY_AGE;
  410. }
  411. interface GroupActivityUnassigned extends GroupActivityBase {
  412. data: Record<string, any>;
  413. type: GroupActivityType.UNASSIGNED;
  414. }
  415. interface GroupActivityFirstSeen extends GroupActivityBase {
  416. data: Record<string, any>;
  417. type: GroupActivityType.FIRST_SEEN;
  418. }
  419. interface GroupActivityMarkReviewed extends GroupActivityBase {
  420. data: Record<string, any>;
  421. type: GroupActivityType.MARK_REVIEWED;
  422. }
  423. interface GroupActivityRegression extends GroupActivityBase {
  424. data: {
  425. /**
  426. * True if the project is using semver to decide if the event is a regression.
  427. * Available when the issue was resolved in a release.
  428. */
  429. follows_semver?: boolean;
  430. /**
  431. * The version that the issue was previously resolved in.
  432. * Available when the issue was resolved in a release.
  433. */
  434. resolved_in_version?: string;
  435. version?: string;
  436. };
  437. type: GroupActivityType.SET_REGRESSION;
  438. }
  439. export interface GroupActivitySetByResolvedInNextSemverRelease extends GroupActivityBase {
  440. data: {
  441. // Set for semver releases
  442. current_release_version: string;
  443. };
  444. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  445. }
  446. export interface GroupActivitySetByResolvedInRelease extends GroupActivityBase {
  447. data: {
  448. version?: string;
  449. };
  450. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  451. }
  452. interface GroupActivitySetByResolvedInCommit extends GroupActivityBase {
  453. data: {
  454. commit?: Commit;
  455. };
  456. type: GroupActivityType.SET_RESOLVED_IN_COMMIT;
  457. }
  458. interface GroupActivitySetByResolvedInPullRequest extends GroupActivityBase {
  459. data: {
  460. pullRequest?: PullRequest;
  461. };
  462. type: GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST;
  463. }
  464. export interface GroupActivitySetIgnored extends GroupActivityBase {
  465. data: {
  466. ignoreCount?: number;
  467. ignoreDuration?: number;
  468. ignoreUntil?: string;
  469. /** Archived until escalating */
  470. ignoreUntilEscalating?: boolean;
  471. ignoreUserCount?: number;
  472. ignoreUserWindow?: number;
  473. ignoreWindow?: number;
  474. };
  475. type: GroupActivityType.SET_IGNORED;
  476. }
  477. export interface GroupActivityReprocess extends GroupActivityBase {
  478. data: {
  479. eventCount: number;
  480. newGroupId: number;
  481. oldGroupId: number;
  482. };
  483. type: GroupActivityType.REPROCESS;
  484. }
  485. interface GroupActivityUnmergeDestination extends GroupActivityBase {
  486. data: {
  487. fingerprints: Array<string>;
  488. source?: {
  489. id: string;
  490. shortId: string;
  491. };
  492. };
  493. type: GroupActivityType.UNMERGE_DESTINATION;
  494. }
  495. interface GroupActivityUnmergeSource extends GroupActivityBase {
  496. data: {
  497. fingerprints: Array<string>;
  498. destination?: {
  499. id: string;
  500. shortId: string;
  501. };
  502. };
  503. type: GroupActivityType.UNMERGE_SOURCE;
  504. }
  505. interface GroupActivityMerge extends GroupActivityBase {
  506. data: {
  507. issues: Array<any>;
  508. };
  509. type: GroupActivityType.MERGE;
  510. }
  511. interface GroupActivityAutoSetOngoing extends GroupActivityBase {
  512. data: {
  513. afterDays?: number;
  514. };
  515. type: GroupActivityType.AUTO_SET_ONGOING;
  516. }
  517. export interface GroupActivitySetEscalating extends GroupActivityBase {
  518. data: {
  519. expired_snooze?: {
  520. count: number | null;
  521. until: Date | null;
  522. user_count: number | null;
  523. user_window: number | null;
  524. window: number | null;
  525. };
  526. forecast?: number;
  527. };
  528. type: GroupActivityType.SET_ESCALATING;
  529. }
  530. export interface GroupActivitySetPriority extends GroupActivityBase {
  531. data: {
  532. priority: PriorityLevel;
  533. reason: string;
  534. };
  535. type: GroupActivityType.SET_PRIORITY;
  536. }
  537. export interface GroupActivityAssigned extends GroupActivityBase {
  538. data: {
  539. assignee: string;
  540. assigneeType: string;
  541. user: Team | User;
  542. assigneeEmail?: string;
  543. /**
  544. * If the user was assigned via an integration
  545. */
  546. integration?:
  547. | 'projectOwnership'
  548. | 'codeowners'
  549. | 'slack'
  550. | 'msteams'
  551. | 'suspectCommitter';
  552. /** Codeowner or Project owner rule as a string */
  553. rule?: string;
  554. };
  555. type: GroupActivityType.ASSIGNED;
  556. }
  557. export interface GroupActivityCreateIssue extends GroupActivityBase {
  558. data: {
  559. location: string;
  560. provider: string;
  561. title: string;
  562. };
  563. type: GroupActivityType.CREATE_ISSUE;
  564. }
  565. export type GroupActivity =
  566. | GroupActivityNote
  567. | GroupActivitySetResolved
  568. | GroupActivitySetResolvedIntegration
  569. | GroupActivitySetUnresolved
  570. | GroupActivitySetUnresolvedForecast
  571. | GroupActivitySetUnresolvedIntegration
  572. | GroupActivitySetIgnored
  573. | GroupActivitySetByAge
  574. | GroupActivitySetByResolvedInRelease
  575. | GroupActivitySetByResolvedInNextSemverRelease
  576. | GroupActivitySetByResolvedInCommit
  577. | GroupActivitySetByResolvedInPullRequest
  578. | GroupActivityFirstSeen
  579. | GroupActivityMerge
  580. | GroupActivityReprocess
  581. | GroupActivityUnassigned
  582. | GroupActivityMarkReviewed
  583. | GroupActivityUnmergeDestination
  584. | GroupActivitySetPublic
  585. | GroupActivitySetPrivate
  586. | GroupActivityRegression
  587. | GroupActivityUnmergeSource
  588. | GroupActivityAssigned
  589. | GroupActivityCreateIssue
  590. | GroupActivityAutoSetOngoing
  591. | GroupActivitySetEscalating
  592. | GroupActivitySetPriority;
  593. export type Activity = GroupActivity;
  594. interface GroupFiltered {
  595. count: string;
  596. firstSeen: string;
  597. lastSeen: string;
  598. stats: Record<string, TimeseriesValue[]>;
  599. userCount: number;
  600. }
  601. export interface GroupStats extends GroupFiltered {
  602. filtered: GroupFiltered | null;
  603. id: string;
  604. isUnhandled?: boolean;
  605. // for issue alert previews, the last time a group triggered a rule
  606. lastTriggered?: string;
  607. lifetime?: GroupFiltered;
  608. sessionCount?: string | null;
  609. }
  610. export interface IgnoredStatusDetails {
  611. actor?: AvatarUser;
  612. ignoreCount?: number;
  613. // Sent in requests. ignoreUntil is used in responses.
  614. ignoreDuration?: number;
  615. ignoreUntil?: string;
  616. ignoreUntilEscalating?: boolean;
  617. ignoreUserCount?: number;
  618. ignoreUserWindow?: number;
  619. ignoreWindow?: number;
  620. }
  621. export interface ResolvedStatusDetails {
  622. actor?: AvatarUser;
  623. autoResolved?: boolean;
  624. inCommit?: {
  625. commit?: string;
  626. dateCreated?: string;
  627. id?: string;
  628. repository?: string | Repository;
  629. };
  630. inNextRelease?: boolean;
  631. inRelease?: string;
  632. repository?: string;
  633. }
  634. interface ReprocessingStatusDetails {
  635. info: {
  636. dateCreated: string;
  637. totalEvents: number;
  638. } | null;
  639. pendingEvents: number;
  640. }
  641. export interface UserParticipant extends User {
  642. type: 'user';
  643. }
  644. export interface TeamParticipant extends Team {
  645. type: 'team';
  646. }
  647. /**
  648. * The payload sent when marking reviewed
  649. */
  650. export interface MarkReviewed {
  651. inbox: false;
  652. }
  653. /**
  654. * The payload sent when updating a group's status
  655. */
  656. export interface GroupStatusResolution {
  657. status: GroupStatus.RESOLVED | GroupStatus.UNRESOLVED | GroupStatus.IGNORED;
  658. statusDetails: ResolvedStatusDetails | IgnoredStatusDetails | {};
  659. substatus?: GroupSubstatus | null;
  660. }
  661. export const enum GroupStatus {
  662. RESOLVED = 'resolved',
  663. UNRESOLVED = 'unresolved',
  664. IGNORED = 'ignored',
  665. REPROCESSING = 'reprocessing',
  666. }
  667. export const enum GroupSubstatus {
  668. ARCHIVED_UNTIL_ESCALATING = 'archived_until_escalating',
  669. ARCHIVED_UNTIL_CONDITION_MET = 'archived_until_condition_met',
  670. ARCHIVED_FOREVER = 'archived_forever',
  671. ESCALATING = 'escalating',
  672. ONGOING = 'ongoing',
  673. REGRESSED = 'regressed',
  674. NEW = 'new',
  675. }
  676. export const enum PriorityLevel {
  677. HIGH = 'high',
  678. MEDIUM = 'medium',
  679. LOW = 'low',
  680. }
  681. // TODO(ts): incomplete
  682. export interface BaseGroup {
  683. activity: GroupActivity[];
  684. annotations: string[];
  685. assignedTo: Actor | null;
  686. culprit: string;
  687. firstSeen: string;
  688. hasSeen: boolean;
  689. id: string;
  690. isBookmarked: boolean;
  691. isPublic: boolean;
  692. isSubscribed: boolean;
  693. issueCategory: IssueCategory;
  694. issueType: IssueType;
  695. lastSeen: string;
  696. level: Level;
  697. logger: string | null;
  698. metadata: EventMetadata;
  699. numComments: number;
  700. participants: Array<UserParticipant | TeamParticipant>;
  701. permalink: string;
  702. platform: PlatformKey;
  703. pluginActions: TitledPlugin[];
  704. pluginContexts: any[]; // TODO(ts)
  705. pluginIssues: TitledPlugin[];
  706. priority: PriorityLevel;
  707. priorityLockedAt: string | null;
  708. project: Project;
  709. seenBy: User[];
  710. shareId: string;
  711. shortId: string;
  712. status: GroupStatus;
  713. statusDetails: IgnoredStatusDetails | ResolvedStatusDetails | ReprocessingStatusDetails;
  714. subscriptionDetails: {disabled?: boolean; reason?: string} | null;
  715. title: string;
  716. type: EventOrGroupType;
  717. userReportCount: number;
  718. inbox?: InboxDetails | null | false;
  719. integrationIssues?: ExternalIssue[];
  720. latestEvent?: Event;
  721. owners?: SuggestedOwner[] | null;
  722. sentryAppIssues?: PlatformExternalIssue[];
  723. substatus?: GroupSubstatus | null;
  724. }
  725. export interface GroupReprocessing extends BaseGroup, GroupStats {
  726. status: GroupStatus.REPROCESSING;
  727. statusDetails: ReprocessingStatusDetails;
  728. }
  729. export interface GroupResolved extends BaseGroup, GroupStats {
  730. status: GroupStatus.RESOLVED;
  731. statusDetails: ResolvedStatusDetails;
  732. }
  733. export interface GroupIgnored extends BaseGroup, GroupStats {
  734. status: GroupStatus.IGNORED;
  735. statusDetails: IgnoredStatusDetails;
  736. }
  737. export interface GroupUnresolved extends BaseGroup, GroupStats {
  738. status: GroupStatus.UNRESOLVED;
  739. statusDetails: {};
  740. }
  741. export type Group = GroupUnresolved | GroupResolved | GroupIgnored | GroupReprocessing;
  742. export interface GroupTombstone {
  743. actor: AvatarUser;
  744. culprit: string;
  745. id: string;
  746. level: Level;
  747. metadata: EventMetadata;
  748. type: EventOrGroupType;
  749. title?: string;
  750. }
  751. export interface GroupTombstoneHelper extends GroupTombstone {
  752. isTombstone: true;
  753. }
  754. export type ProcessingIssueItem = {
  755. checksum: string;
  756. data: {
  757. // TODO(ts) This type is likely incomplete, but this is what
  758. // project processing issues settings uses.
  759. _scope: string;
  760. image_arch: string;
  761. image_path: string;
  762. image_uuid: string;
  763. dist?: string;
  764. release?: string;
  765. };
  766. id: string;
  767. lastSeen: string;
  768. numEvents: number;
  769. type: string;
  770. };
  771. export type ProcessingIssue = {
  772. hasIssues: boolean;
  773. hasMoreResolveableIssues: boolean;
  774. issuesProcessing: number;
  775. lastSeen: string;
  776. numIssues: number;
  777. project: string;
  778. resolveableIssues: number;
  779. signedLink: string;
  780. issues?: ProcessingIssueItem[];
  781. };
  782. /**
  783. * Datascrubbing
  784. */
  785. export type Meta = {
  786. chunks: Array<ChunkType>;
  787. err: Array<MetaError>;
  788. len: number;
  789. rem: Array<MetaRemark>;
  790. };
  791. export type MetaError = string | [string, any];
  792. export type MetaRemark = Array<string | number>;
  793. export type ChunkType = {
  794. rule_id: string | number;
  795. text: string;
  796. type: string;
  797. remark?: string | number;
  798. };
  799. /**
  800. * Old User Feedback
  801. */
  802. export type UserReport = {
  803. comments: string;
  804. dateCreated: string;
  805. email: string;
  806. event: {eventID: string; id: string};
  807. eventID: string;
  808. id: string;
  809. issue: Group;
  810. name: string;
  811. user: User;
  812. };
  813. export type KeyValueListDataItem = {
  814. key: string;
  815. subject: string;
  816. action?: {
  817. link?: string | LocationDescriptor;
  818. };
  819. actionButton?: React.ReactNode;
  820. isContextData?: boolean;
  821. isMultiValue?: boolean;
  822. meta?: Meta;
  823. subjectDataTestId?: string;
  824. subjectIcon?: React.ReactNode;
  825. value?: React.ReactNode | Record<string, string | number>;
  826. };
  827. export type KeyValueListData = KeyValueListDataItem[];
  828. // Response from ShortIdLookupEndpoint
  829. // /organizations/${orgId}/shortids/${query}/
  830. export type ShortIdResponse = {
  831. group: Group;
  832. groupId: string;
  833. organizationSlug: string;
  834. projectSlug: string;
  835. shortId: string;
  836. };
  837. /**
  838. * Note used in Group Activity and Alerts for users to comment
  839. */
  840. export type Note = {
  841. /**
  842. * Array of [id, display string] tuples used for @-mentions
  843. */
  844. mentions: [string, string][];
  845. /**
  846. * Note contents (markdown allowed)
  847. */
  848. text: string;
  849. };