group.tsx 22 KB

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