group.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  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?: 'projectOwnership' | 'codeowners' | 'slack' | 'msteams';
  503. /** Codeowner or Project owner rule as a string */
  504. rule?: string;
  505. };
  506. type: GroupActivityType.ASSIGNED;
  507. }
  508. export interface GroupActivityCreateIssue extends GroupActivityBase {
  509. data: {
  510. location: string;
  511. provider: string;
  512. title: string;
  513. };
  514. type: GroupActivityType.CREATE_ISSUE;
  515. }
  516. export type GroupActivity =
  517. | GroupActivityNote
  518. | GroupActivitySetResolved
  519. | GroupActivitySetResolvedIntegration
  520. | GroupActivitySetUnresolved
  521. | GroupActivitySetUnresolvedForecast
  522. | GroupActivitySetUnresolvedIntegration
  523. | GroupActivitySetIgnored
  524. | GroupActivitySetByAge
  525. | GroupActivitySetByResolvedInRelease
  526. | GroupActivitySetByResolvedInNextSemverRelease
  527. | GroupActivitySetByResolvedInCommit
  528. | GroupActivitySetByResolvedInPullRequest
  529. | GroupActivityFirstSeen
  530. | GroupActivityMerge
  531. | GroupActivityReprocess
  532. | GroupActivityUnassigned
  533. | GroupActivityMarkReviewed
  534. | GroupActivityUnmergeDestination
  535. | GroupActivitySetPublic
  536. | GroupActivitySetPrivate
  537. | GroupActivityRegression
  538. | GroupActivityUnmergeSource
  539. | GroupActivityAssigned
  540. | GroupActivityCreateIssue
  541. | GroupActivityAutoSetOngoing
  542. | GroupActivitySetEscalating
  543. | GroupActivitySetPriority;
  544. export type Activity = GroupActivity;
  545. interface GroupFiltered {
  546. count: string;
  547. firstSeen: string;
  548. lastSeen: string;
  549. stats: Record<string, TimeseriesValue[]>;
  550. userCount: number;
  551. }
  552. export interface GroupStats extends GroupFiltered {
  553. filtered: GroupFiltered | null;
  554. id: string;
  555. isUnhandled?: boolean;
  556. // for issue alert previews, the last time a group triggered a rule
  557. lastTriggered?: string;
  558. lifetime?: GroupFiltered;
  559. sessionCount?: string | null;
  560. }
  561. export interface IgnoredStatusDetails {
  562. actor?: AvatarUser;
  563. ignoreCount?: number;
  564. // Sent in requests. ignoreUntil is used in responses.
  565. ignoreDuration?: number;
  566. ignoreUntil?: string;
  567. ignoreUntilEscalating?: boolean;
  568. ignoreUserCount?: number;
  569. ignoreUserWindow?: number;
  570. ignoreWindow?: number;
  571. }
  572. export interface ResolvedStatusDetails {
  573. actor?: AvatarUser;
  574. autoResolved?: boolean;
  575. inCommit?: {
  576. commit?: string;
  577. dateCreated?: string;
  578. id?: string;
  579. repository?: string | Repository;
  580. };
  581. inNextRelease?: boolean;
  582. inRelease?: string;
  583. repository?: string;
  584. }
  585. interface ReprocessingStatusDetails {
  586. info: {
  587. dateCreated: string;
  588. totalEvents: number;
  589. } | null;
  590. pendingEvents: number;
  591. }
  592. export interface UserParticipant extends User {
  593. type: 'user';
  594. }
  595. export interface TeamParticipant extends Team {
  596. type: 'team';
  597. }
  598. /**
  599. * The payload sent when marking reviewed
  600. */
  601. export interface MarkReviewed {
  602. inbox: false;
  603. }
  604. /**
  605. * The payload sent when updating a group's status
  606. */
  607. export interface GroupStatusResolution {
  608. status: GroupStatus.RESOLVED | GroupStatus.UNRESOLVED | GroupStatus.IGNORED;
  609. statusDetails: ResolvedStatusDetails | IgnoredStatusDetails | {};
  610. substatus?: GroupSubstatus | null;
  611. }
  612. export const enum GroupStatus {
  613. RESOLVED = 'resolved',
  614. UNRESOLVED = 'unresolved',
  615. IGNORED = 'ignored',
  616. REPROCESSING = 'reprocessing',
  617. }
  618. export const enum GroupSubstatus {
  619. ARCHIVED_UNTIL_ESCALATING = 'archived_until_escalating',
  620. ARCHIVED_UNTIL_CONDITION_MET = 'archived_until_condition_met',
  621. ARCHIVED_FOREVER = 'archived_forever',
  622. ESCALATING = 'escalating',
  623. ONGOING = 'ongoing',
  624. REGRESSED = 'regressed',
  625. NEW = 'new',
  626. }
  627. export const enum PriorityLevel {
  628. HIGH = 'high',
  629. MEDIUM = 'medium',
  630. LOW = 'low',
  631. }
  632. // TODO(ts): incomplete
  633. export interface BaseGroup {
  634. activity: GroupActivity[];
  635. annotations: string[];
  636. assignedTo: Actor | null;
  637. culprit: string;
  638. firstSeen: string;
  639. hasSeen: boolean;
  640. id: string;
  641. isBookmarked: boolean;
  642. isPublic: boolean;
  643. isSubscribed: boolean;
  644. issueCategory: IssueCategory;
  645. issueType: IssueType;
  646. lastSeen: string;
  647. level: Level;
  648. logger: string | null;
  649. metadata: EventMetadata;
  650. numComments: number;
  651. participants: Array<UserParticipant | TeamParticipant>;
  652. permalink: string;
  653. platform: PlatformKey;
  654. pluginActions: TitledPlugin[];
  655. pluginContexts: any[]; // TODO(ts)
  656. pluginIssues: TitledPlugin[];
  657. priority: PriorityLevel;
  658. project: Project;
  659. seenBy: User[];
  660. shareId: string;
  661. shortId: string;
  662. status: GroupStatus;
  663. statusDetails: IgnoredStatusDetails | ResolvedStatusDetails | ReprocessingStatusDetails;
  664. subscriptionDetails: {disabled?: boolean; reason?: string} | null;
  665. title: string;
  666. type: EventOrGroupType;
  667. userReportCount: number;
  668. inbox?: InboxDetails | null | false;
  669. integrationIssues?: ExternalIssue[];
  670. latestEvent?: Event;
  671. owners?: SuggestedOwner[] | null;
  672. sentryAppIssues?: PlatformExternalIssue[];
  673. substatus?: GroupSubstatus | null;
  674. }
  675. export interface GroupReprocessing extends BaseGroup, GroupStats {
  676. status: GroupStatus.REPROCESSING;
  677. statusDetails: ReprocessingStatusDetails;
  678. }
  679. export interface GroupResolved extends BaseGroup, GroupStats {
  680. status: GroupStatus.RESOLVED;
  681. statusDetails: ResolvedStatusDetails;
  682. }
  683. export interface GroupIgnored extends BaseGroup, GroupStats {
  684. status: GroupStatus.IGNORED;
  685. statusDetails: IgnoredStatusDetails;
  686. }
  687. export interface GroupUnresolved extends BaseGroup, GroupStats {
  688. status: GroupStatus.UNRESOLVED;
  689. statusDetails: {};
  690. }
  691. export type Group = GroupUnresolved | GroupResolved | GroupIgnored | GroupReprocessing;
  692. export interface GroupTombstone {
  693. actor: AvatarUser;
  694. culprit: string;
  695. id: string;
  696. level: Level;
  697. metadata: EventMetadata;
  698. type: EventOrGroupType;
  699. title?: string;
  700. }
  701. export interface GroupTombstoneHelper extends GroupTombstone {
  702. isTombstone: true;
  703. }
  704. export type ProcessingIssueItem = {
  705. checksum: string;
  706. data: {
  707. // TODO(ts) This type is likely incomplete, but this is what
  708. // project processing issues settings uses.
  709. _scope: string;
  710. image_arch: string;
  711. image_path: string;
  712. image_uuid: string;
  713. dist?: string;
  714. release?: string;
  715. };
  716. id: string;
  717. lastSeen: string;
  718. numEvents: number;
  719. type: string;
  720. };
  721. export type ProcessingIssue = {
  722. hasIssues: boolean;
  723. hasMoreResolveableIssues: boolean;
  724. issuesProcessing: number;
  725. lastSeen: string;
  726. numIssues: number;
  727. project: string;
  728. resolveableIssues: number;
  729. signedLink: string;
  730. issues?: ProcessingIssueItem[];
  731. };
  732. /**
  733. * Datascrubbing
  734. */
  735. export type Meta = {
  736. chunks: Array<ChunkType>;
  737. err: Array<MetaError>;
  738. len: number;
  739. rem: Array<MetaRemark>;
  740. };
  741. export type MetaError = string | [string, any];
  742. export type MetaRemark = Array<string | number>;
  743. export type ChunkType = {
  744. rule_id: string | number;
  745. text: string;
  746. type: string;
  747. remark?: string | number;
  748. };
  749. /**
  750. * Old User Feedback
  751. */
  752. export type UserReport = {
  753. comments: string;
  754. dateCreated: string;
  755. email: string;
  756. event: {eventID: string; id: string};
  757. eventID: string;
  758. id: string;
  759. issue: Group;
  760. name: string;
  761. user: User;
  762. };
  763. export type KeyValueListDataItem = {
  764. key: string;
  765. subject: string;
  766. actionButton?: React.ReactNode;
  767. isContextData?: boolean;
  768. isMultiValue?: boolean;
  769. meta?: Meta;
  770. subjectDataTestId?: string;
  771. subjectIcon?: React.ReactNode;
  772. value?: React.ReactNode;
  773. };
  774. export type KeyValueListData = KeyValueListDataItem[];
  775. // Response from ShortIdLookupEndpoint
  776. // /organizations/${orgId}/shortids/${query}/
  777. export type ShortIdResponse = {
  778. group: Group;
  779. groupId: string;
  780. organizationSlug: string;
  781. projectSlug: string;
  782. shortId: string;
  783. };
  784. /**
  785. * Note used in Group Activity and Alerts for users to comment
  786. */
  787. export type Note = {
  788. /**
  789. * Array of [id, display string] tuples used for @-mentions
  790. */
  791. mentions: [string, string][];
  792. /**
  793. * Note contents (markdown allowed)
  794. */
  795. text: string;
  796. };