group.tsx 22 KB

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