event.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. import type {
  2. RawSpanType,
  3. TraceContextType,
  4. } from 'sentry/components/events/interfaces/spans/types';
  5. import type {SymbolicatorStatus} from 'sentry/components/events/interfaces/types';
  6. import type {PlatformKey} from 'sentry/data/platformCategories';
  7. import type {IssueType} from 'sentry/types';
  8. import type {RawCrumb} from './breadcrumbs';
  9. import type {Image} from './debugImage';
  10. import type {IssueAttachment, IssueCategory} from './group';
  11. import type {Release} from './release';
  12. import type {RawStacktrace, StackTraceMechanism, StacktraceType} from './stacktrace';
  13. // TODO(epurkhiser): objc and cocoa should almost definitely be moved into PlatformKey
  14. export type PlatformType = PlatformKey | 'objc' | 'cocoa';
  15. export type Level = 'error' | 'fatal' | 'info' | 'warning' | 'sample' | 'unknown';
  16. /**
  17. * Grouping Configuration.
  18. */
  19. export type EventGroupComponent = {
  20. contributes: boolean;
  21. hint: string | null;
  22. id: string;
  23. name: string | null;
  24. values: EventGroupComponent[] | string[];
  25. };
  26. export type EventGroupingConfig = {
  27. base: string | null;
  28. changelog: string;
  29. delegates: string[];
  30. hidden: boolean;
  31. id: string;
  32. latest: boolean;
  33. risk: number;
  34. strategies: string[];
  35. };
  36. export type VariantEvidence = {
  37. desc: string;
  38. fingerprint: string;
  39. cause_span_hashes?: string[];
  40. offender_span_hashes?: string[];
  41. op?: string;
  42. parent_span_hashes?: string[];
  43. };
  44. type EventGroupVariantKey = 'custom-fingerprint' | 'app' | 'default' | 'system';
  45. export enum EventGroupVariantType {
  46. CHECKSUM = 'checksum',
  47. FALLBACK = 'fallback',
  48. CUSTOM_FINGERPRINT = 'custom-fingerprint',
  49. COMPONENT = 'component',
  50. SALTED_COMPONENT = 'salted-component',
  51. PERFORMANCE_PROBLEM = 'performance-problem',
  52. }
  53. interface BaseVariant {
  54. description: string | null;
  55. hash: string | null;
  56. hashMismatch: boolean;
  57. key: string;
  58. type: string;
  59. }
  60. interface FallbackVariant extends BaseVariant {
  61. type: EventGroupVariantType.FALLBACK;
  62. }
  63. interface ChecksumVariant extends BaseVariant {
  64. type: EventGroupVariantType.CHECKSUM;
  65. }
  66. interface HasComponentGrouping {
  67. client_values?: Array<string>;
  68. component?: EventGroupComponent;
  69. config?: EventGroupingConfig;
  70. matched_rule?: string;
  71. values?: Array<string>;
  72. }
  73. interface ComponentVariant extends BaseVariant, HasComponentGrouping {
  74. type: EventGroupVariantType.COMPONENT;
  75. }
  76. interface CustomFingerprintVariant extends BaseVariant, HasComponentGrouping {
  77. type: EventGroupVariantType.CUSTOM_FINGERPRINT;
  78. }
  79. interface SaltedComponentVariant extends BaseVariant, HasComponentGrouping {
  80. type: EventGroupVariantType.SALTED_COMPONENT;
  81. }
  82. interface PerformanceProblemVariant extends BaseVariant {
  83. evidence: VariantEvidence;
  84. type: EventGroupVariantType.PERFORMANCE_PROBLEM;
  85. }
  86. export type EventGroupVariant =
  87. | FallbackVariant
  88. | ChecksumVariant
  89. | ComponentVariant
  90. | SaltedComponentVariant
  91. | CustomFingerprintVariant
  92. | PerformanceProblemVariant;
  93. export type EventGroupInfo = Record<EventGroupVariantKey, EventGroupVariant>;
  94. /**
  95. * SDK Update metadata
  96. */
  97. type EnableIntegrationSuggestion = {
  98. enables: Array<SDKUpdatesSuggestion>;
  99. integrationName: string;
  100. type: 'enableIntegration';
  101. integrationUrl?: string | null;
  102. };
  103. export type UpdateSdkSuggestion = {
  104. enables: Array<SDKUpdatesSuggestion>;
  105. newSdkVersion: string;
  106. sdkName: string;
  107. type: 'updateSdk';
  108. sdkUrl?: string | null;
  109. };
  110. type ChangeSdkSuggestion = {
  111. enables: Array<SDKUpdatesSuggestion>;
  112. newSdkName: string;
  113. type: 'changeSdk';
  114. sdkUrl?: string | null;
  115. };
  116. export type SDKUpdatesSuggestion =
  117. | EnableIntegrationSuggestion
  118. | UpdateSdkSuggestion
  119. | ChangeSdkSuggestion;
  120. /**
  121. * Frames, Threads and Event interfaces.
  122. */
  123. export interface Thread {
  124. crashed: boolean;
  125. current: boolean;
  126. id: number;
  127. rawStacktrace: RawStacktrace;
  128. stacktrace: StacktraceType | null;
  129. lockReason?: string | null;
  130. name?: string | null;
  131. state?: string | null;
  132. }
  133. export type Frame = {
  134. absPath: string | null;
  135. colNo: number | null;
  136. context: Array<[number, string]>;
  137. errors: Array<any> | null;
  138. filename: string | null;
  139. function: string | null;
  140. inApp: boolean;
  141. instructionAddr: string | null;
  142. lineNo: number | null;
  143. module: string | null;
  144. package: string | null;
  145. platform: PlatformType | null;
  146. rawFunction: string | null;
  147. symbol: string | null;
  148. symbolAddr: string | null;
  149. trust: any | null;
  150. vars: Record<string, any> | null;
  151. addrMode?: string;
  152. isPrefix?: boolean;
  153. isSentinel?: boolean;
  154. map?: string | null;
  155. mapUrl?: string | null;
  156. minGroupingLevel?: number;
  157. origAbsPath?: string | null;
  158. symbolicatorStatus?: SymbolicatorStatus;
  159. };
  160. export enum FrameBadge {
  161. SENTINEL = 'sentinel',
  162. PREFIX = 'prefix',
  163. GROUPING = 'grouping',
  164. }
  165. export type ExceptionValue = {
  166. mechanism: StackTraceMechanism | null;
  167. module: string | null;
  168. rawStacktrace: RawStacktrace;
  169. stacktrace: StacktraceType | null;
  170. threadId: number | null;
  171. type: string;
  172. value: string;
  173. frames?: Frame[] | null;
  174. };
  175. export type ExceptionType = {
  176. excOmitted: any | null;
  177. hasSystemFrames: boolean;
  178. values?: Array<ExceptionValue>;
  179. };
  180. export type TreeLabelPart =
  181. | string
  182. | {
  183. classbase?: string;
  184. datapath?: (string | number)[];
  185. filebase?: string;
  186. function?: string;
  187. is_prefix?: boolean;
  188. // is_sentinel is no longer being used,
  189. // but we will still assess whether we will use this property in the near future.
  190. is_sentinel?: boolean;
  191. package?: string;
  192. type?: string;
  193. };
  194. // This type is incomplete
  195. export type EventMetadata = {
  196. current_level?: number;
  197. current_tree_label?: TreeLabelPart[];
  198. directive?: string;
  199. display_title_with_tree_label?: boolean;
  200. filename?: string;
  201. finest_tree_label?: TreeLabelPart[];
  202. function?: string;
  203. message?: string;
  204. origin?: string;
  205. stripped_crash?: boolean;
  206. title?: string;
  207. type?: string;
  208. uri?: string;
  209. value?: string;
  210. };
  211. export enum EventOrGroupType {
  212. ERROR = 'error',
  213. CSP = 'csp',
  214. HPKP = 'hpkp',
  215. EXPECTCT = 'expectct',
  216. EXPECTSTAPLE = 'expectstaple',
  217. DEFAULT = 'default',
  218. TRANSACTION = 'transaction',
  219. GENERIC = 'generic',
  220. }
  221. /**
  222. * Event interface types.
  223. */
  224. export enum EntryType {
  225. EXCEPTION = 'exception',
  226. MESSAGE = 'message',
  227. REQUEST = 'request',
  228. STACKTRACE = 'stacktrace',
  229. TEMPLATE = 'template',
  230. CSP = 'csp',
  231. EXPECTCT = 'expectct',
  232. EXPECTSTAPLE = 'expectstaple',
  233. HPKP = 'hpkp',
  234. BREADCRUMBS = 'breadcrumbs',
  235. THREADS = 'threads',
  236. THREAD_STATE = 'thread-state',
  237. THREAD_TAGS = 'thread-tags',
  238. DEBUGMETA = 'debugmeta',
  239. SPANS = 'spans',
  240. RESOURCES = 'resources',
  241. }
  242. type EntryDebugMeta = {
  243. data: {
  244. images: Array<Image | null>;
  245. };
  246. type: EntryType.DEBUGMETA;
  247. };
  248. type EntryBreadcrumbs = {
  249. data: {
  250. values: Array<RawCrumb>;
  251. };
  252. type: EntryType.BREADCRUMBS;
  253. };
  254. export type EntryThreads = {
  255. data: {
  256. values?: Array<Thread>;
  257. };
  258. type: EntryType.THREADS;
  259. };
  260. export type EntryException = {
  261. data: ExceptionType;
  262. type: EntryType.EXCEPTION;
  263. };
  264. type EntryStacktrace = {
  265. data: StacktraceType;
  266. type: EntryType.STACKTRACE;
  267. };
  268. export type EntrySpans = {
  269. data: RawSpanType[];
  270. type: EntryType.SPANS;
  271. };
  272. type EntryMessage = {
  273. data: {
  274. formatted: string;
  275. params?: Record<string, any> | any[];
  276. };
  277. type: EntryType.MESSAGE;
  278. };
  279. export type EntryRequest = {
  280. data: {
  281. method: string;
  282. url: string;
  283. cookies?: [key: string, value: string][];
  284. data?: string | null | Record<string, any> | [key: string, value: any][];
  285. env?: Record<string, string>;
  286. fragment?: string | null;
  287. headers?: [key: string, value: string][];
  288. inferredContentType?:
  289. | null
  290. | 'application/json'
  291. | 'application/x-www-form-urlencoded'
  292. | 'multipart/form-data';
  293. query?: [key: string, value: string][] | string;
  294. };
  295. type: EntryType.REQUEST;
  296. };
  297. type EntryTemplate = {
  298. data: Frame;
  299. type: EntryType.TEMPLATE;
  300. };
  301. type EntryCsp = {
  302. data: Record<string, any>;
  303. type: EntryType.CSP;
  304. };
  305. type EntryGeneric = {
  306. data: Record<string, any>;
  307. type: EntryType.EXPECTCT | EntryType.EXPECTSTAPLE | EntryType.HPKP;
  308. };
  309. type EntryResources = {
  310. data: any; // Data is unused here
  311. type: EntryType.RESOURCES;
  312. };
  313. export type Entry =
  314. | EntryDebugMeta
  315. | EntryBreadcrumbs
  316. | EntryThreads
  317. | EntryException
  318. | EntryStacktrace
  319. | EntrySpans
  320. | EntryMessage
  321. | EntryRequest
  322. | EntryTemplate
  323. | EntryCsp
  324. | EntryGeneric
  325. | EntryResources;
  326. // Contexts: https://develop.sentry.dev/sdk/event-payloads/contexts/
  327. export interface BaseContext {
  328. type: string;
  329. }
  330. export enum DeviceContextKey {
  331. ARCH = 'arch',
  332. BATTERY_LEVEL = 'battery_level',
  333. BATTERY_STATUS = 'battery_status',
  334. BOOT_TIME = 'boot_time',
  335. BRAND = 'brand',
  336. CHARGING = 'charging',
  337. CPU_DESCRIPTION = 'cpu_description',
  338. DEVICE_TYPE = 'device_type',
  339. DEVICE_UNIQUE_IDENTIFIER = 'device_unique_identifier',
  340. EXTERNAL_FREE_STORAGE = 'external_free_storage',
  341. EXTERNAL_STORAGE_SIZE = 'external_storage_size',
  342. EXTERNAL_TOTAL_STORAGE = 'external_total_storage',
  343. FAMILY = 'family',
  344. FREE_MEMORY = 'free_memory',
  345. FREE_STORAGE = 'free_storage',
  346. LOW_MEMORY = 'low_memory',
  347. MANUFACTURER = 'manufacturer',
  348. MEMORY_SIZE = 'memory_size',
  349. MODEL = 'model',
  350. MODEL_ID = 'model_id',
  351. NAME = 'name',
  352. ONLINE = 'online',
  353. ORIENTATION = 'orientation',
  354. PROCESSOR_COUNT = 'processor_count',
  355. PROCESSOR_FREQUENCY = 'processor_frequency',
  356. SCREEN_DENSITY = 'screen_density',
  357. SCREEN_DPI = 'screen_dpi',
  358. SCREEN_HEIGHT_PIXELS = 'screen_height_pixels',
  359. SCREEN_RESOLUTION = 'screen_resolution',
  360. SCREEN_WIDTH_PIXELS = 'screen_width_pixels',
  361. SIMULATOR = 'simulator',
  362. STORAGE_SIZE = 'storage_size',
  363. SUPPORTS_ACCELEROMETER = 'supports_accelerometer',
  364. SUPPORTS_AUDIO = 'supports_audio',
  365. SUPPORTS_GYROSCOPE = 'supports_gyroscope',
  366. SUPPORTS_LOCATION_SERVICE = 'supports_location_service',
  367. SUPPORTS_VIBRATION = 'supports_vibration',
  368. USABLE_MEMORY = 'usable_memory',
  369. }
  370. // https://develop.sentry.dev/sdk/event-payloads/contexts/#device-context
  371. export interface DeviceContext
  372. extends Partial<Record<DeviceContextKey, unknown>>,
  373. BaseContext {
  374. type: 'device';
  375. [DeviceContextKey.NAME]: string;
  376. [DeviceContextKey.ARCH]?: string;
  377. [DeviceContextKey.BATTERY_LEVEL]?: number;
  378. [DeviceContextKey.BATTERY_STATUS]?: string;
  379. [DeviceContextKey.BOOT_TIME]?: string;
  380. [DeviceContextKey.BRAND]?: string;
  381. [DeviceContextKey.CHARGING]?: boolean;
  382. [DeviceContextKey.CPU_DESCRIPTION]?: string;
  383. [DeviceContextKey.DEVICE_TYPE]?: string;
  384. [DeviceContextKey.DEVICE_UNIQUE_IDENTIFIER]?: string;
  385. [DeviceContextKey.EXTERNAL_FREE_STORAGE]?: number;
  386. [DeviceContextKey.EXTERNAL_STORAGE_SIZE]?: number;
  387. [DeviceContextKey.EXTERNAL_TOTAL_STORAGE]?: number;
  388. [DeviceContextKey.FAMILY]?: string;
  389. [DeviceContextKey.FREE_MEMORY]?: number;
  390. [DeviceContextKey.FREE_STORAGE]?: number;
  391. [DeviceContextKey.LOW_MEMORY]?: boolean;
  392. [DeviceContextKey.MANUFACTURER]?: string;
  393. [DeviceContextKey.MEMORY_SIZE]?: number;
  394. [DeviceContextKey.MODEL]?: string;
  395. [DeviceContextKey.MODEL_ID]?: string;
  396. [DeviceContextKey.ONLINE]?: boolean;
  397. [DeviceContextKey.ORIENTATION]?: 'portrait' | 'landscape';
  398. [DeviceContextKey.PROCESSOR_COUNT]?: number;
  399. [DeviceContextKey.PROCESSOR_FREQUENCY]?: number;
  400. [DeviceContextKey.SCREEN_DENSITY]?: number;
  401. [DeviceContextKey.SCREEN_DPI]?: number;
  402. [DeviceContextKey.SCREEN_HEIGHT_PIXELS]?: number;
  403. [DeviceContextKey.SCREEN_RESOLUTION]?: string;
  404. [DeviceContextKey.SCREEN_WIDTH_PIXELS]?: number;
  405. [DeviceContextKey.SIMULATOR]?: boolean;
  406. [DeviceContextKey.STORAGE_SIZE]?: number;
  407. [DeviceContextKey.SUPPORTS_ACCELEROMETER]?: boolean;
  408. [DeviceContextKey.SUPPORTS_AUDIO]?: boolean;
  409. [DeviceContextKey.SUPPORTS_GYROSCOPE]?: boolean;
  410. [DeviceContextKey.SUPPORTS_LOCATION_SERVICE]?: boolean;
  411. [DeviceContextKey.SUPPORTS_VIBRATION]?: boolean;
  412. [DeviceContextKey.USABLE_MEMORY]?: number;
  413. // This field is deprecated in favour of locale field in culture context
  414. language?: string;
  415. // This field is deprecated in favour of timezone field in culture context
  416. timezone?: string;
  417. }
  418. enum RuntimeContextKey {
  419. BUILD = 'build',
  420. NAME = 'name',
  421. RAW_DESCRIPTION = 'raw_description',
  422. VERSION = 'version',
  423. }
  424. // https://develop.sentry.dev/sdk/event-payloads/contexts/#runtime-context
  425. interface RuntimeContext
  426. extends Partial<Record<RuntimeContextKey, unknown>>,
  427. BaseContext {
  428. type: 'runtime';
  429. [RuntimeContextKey.BUILD]?: string;
  430. [RuntimeContextKey.NAME]?: string;
  431. [RuntimeContextKey.RAW_DESCRIPTION]?: string;
  432. [RuntimeContextKey.VERSION]?: number;
  433. }
  434. type OSContext = {
  435. build: string;
  436. kernel_version: string;
  437. name: string;
  438. type: string;
  439. version: string;
  440. };
  441. export enum OtelContextKey {
  442. ATTRIBUTES = 'attributes',
  443. RESOURCE = 'resource',
  444. }
  445. // OpenTelemetry Context
  446. // https://develop.sentry.dev/sdk/performance/opentelemetry/#opentelemetry-context
  447. interface OtelContext extends Partial<Record<OtelContextKey, unknown>>, BaseContext {
  448. type: 'otel';
  449. [OtelContextKey.ATTRIBUTES]?: Record<string, unknown>;
  450. [OtelContextKey.RESOURCE]?: Record<string, unknown>;
  451. }
  452. export enum UnityContextKey {
  453. COPY_TEXTURE_SUPPORT = 'copy_texture_support',
  454. EDITOR_VERSION = 'editor_version',
  455. INSTALL_MODE = 'install_mode',
  456. RENDERING_THREADING_MODE = 'rendering_threading_mode',
  457. TARGET_FRAME_RATE = 'target_frame_rate',
  458. }
  459. // Unity Context
  460. // TODO(Priscila): Add this context to the docs
  461. export interface UnityContext {
  462. [UnityContextKey.COPY_TEXTURE_SUPPORT]: string;
  463. [UnityContextKey.EDITOR_VERSION]: string;
  464. [UnityContextKey.INSTALL_MODE]: string;
  465. [UnityContextKey.RENDERING_THREADING_MODE]: string;
  466. [UnityContextKey.TARGET_FRAME_RATE]: string;
  467. type: 'unity';
  468. }
  469. export enum MemoryInfoContextKey {
  470. ALLOCATED_BYTES = 'allocated_bytes',
  471. FRAGMENTED_BYTES = 'fragmented_bytes',
  472. HEAP_SIZE_BYTES = 'heap_size_bytes',
  473. HIGH_MEMORY_LOAD_THRESHOLD_BYTES = 'high_memory_load_threshold_bytes',
  474. TOTAL_AVAILABLE_MEMORY_BYTES = 'total_available_memory_bytes',
  475. MEMORY_LOAD_BYTES = 'memory_load_bytes',
  476. TOTAL_COMMITTED_BYTES = 'total_committed_bytes',
  477. PROMOTED_BYTES = 'promoted_bytes',
  478. PINNED_OBJECTS_COUNT = 'pinned_objects_count',
  479. PAUSE_TIME_PERCENTAGE = 'pause_time_percentage',
  480. INDEX = 'index',
  481. FINALIZATION_PENDING_COUNT = 'finalization_pending_count',
  482. COMPACTED = 'compacted',
  483. CONCURRENT = 'concurrent',
  484. PAUSE_DURATIONS = 'pause_durations',
  485. }
  486. // MemoryInfo Context
  487. // TODO(Priscila): Add this context to the docs
  488. export interface MemoryInfoContext {
  489. type: 'Memory Info' | 'memory_info';
  490. [MemoryInfoContextKey.FINALIZATION_PENDING_COUNT]: number;
  491. [MemoryInfoContextKey.COMPACTED]: boolean;
  492. [MemoryInfoContextKey.CONCURRENT]: boolean;
  493. [MemoryInfoContextKey.PAUSE_DURATIONS]: number[];
  494. [MemoryInfoContextKey.TOTAL_AVAILABLE_MEMORY_BYTES]?: number;
  495. [MemoryInfoContextKey.MEMORY_LOAD_BYTES]?: number;
  496. [MemoryInfoContextKey.TOTAL_COMMITTED_BYTES]?: number;
  497. [MemoryInfoContextKey.PROMOTED_BYTES]?: number;
  498. [MemoryInfoContextKey.PINNED_OBJECTS_COUNT]?: number;
  499. [MemoryInfoContextKey.PAUSE_TIME_PERCENTAGE]?: number;
  500. [MemoryInfoContextKey.INDEX]?: number;
  501. [MemoryInfoContextKey.ALLOCATED_BYTES]?: number;
  502. [MemoryInfoContextKey.FRAGMENTED_BYTES]?: number;
  503. [MemoryInfoContextKey.HEAP_SIZE_BYTES]?: number;
  504. [MemoryInfoContextKey.HIGH_MEMORY_LOAD_THRESHOLD_BYTES]?: number;
  505. }
  506. export enum ThreadPoolInfoContextKey {
  507. MIN_WORKER_THREADS = 'min_worker_threads',
  508. MIN_COMPLETION_PORT_THREADS = 'min_completion_port_threads',
  509. MAX_WORKER_THREADS = 'max_worker_threads',
  510. MAX_COMPLETION_PORT_THREADS = 'max_completion_port_threads',
  511. AVAILABLE_WORKER_THREADS = 'available_worker_threads',
  512. AVAILABLE_COMPLETION_PORT_THREADS = 'available_completion_port_threads',
  513. }
  514. // ThreadPoolInfo Context
  515. // TODO(Priscila): Add this context to the docs
  516. export interface ThreadPoolInfoContext {
  517. type: 'ThreadPool Info' | 'threadpool_info';
  518. [ThreadPoolInfoContextKey.MIN_WORKER_THREADS]: number;
  519. [ThreadPoolInfoContextKey.MIN_COMPLETION_PORT_THREADS]: number;
  520. [ThreadPoolInfoContextKey.MAX_WORKER_THREADS]: number;
  521. [ThreadPoolInfoContextKey.MAX_COMPLETION_PORT_THREADS]: number;
  522. [ThreadPoolInfoContextKey.AVAILABLE_WORKER_THREADS]: number;
  523. [ThreadPoolInfoContextKey.AVAILABLE_COMPLETION_PORT_THREADS]: number;
  524. }
  525. export enum ProfileContextKey {
  526. PROFILE_ID = 'profile_id',
  527. }
  528. export interface ProfileContext {
  529. [ProfileContextKey.PROFILE_ID]?: string;
  530. }
  531. export interface BrowserContext {
  532. name: string;
  533. version: string;
  534. }
  535. type EventContexts = {
  536. 'Memory Info'?: MemoryInfoContext;
  537. 'ThreadPool Info'?: ThreadPoolInfoContext;
  538. browser?: BrowserContext;
  539. client_os?: OSContext;
  540. device?: DeviceContext;
  541. feedback?: Record<string, any>;
  542. memory_info?: MemoryInfoContext;
  543. os?: OSContext;
  544. otel?: OtelContext;
  545. // TODO (udameli): add better types here
  546. // once perf issue data shape is more clear
  547. performance_issue?: any;
  548. runtime?: RuntimeContext;
  549. threadpool_info?: ThreadPoolInfoContext;
  550. trace?: TraceContextType;
  551. unity?: UnityContext;
  552. };
  553. export type Measurement = {value: number; unit?: string};
  554. export type EventTag = {key: string; value: string};
  555. export type EventUser = {
  556. data?: string | null;
  557. email?: string;
  558. id?: string;
  559. ip_address?: string;
  560. name?: string | null;
  561. username?: string | null;
  562. };
  563. export type PerformanceDetectorData = {
  564. causeSpanIds: string[];
  565. offenderSpanIds: string[];
  566. parentSpanIds: string[];
  567. issueType?: IssueType;
  568. };
  569. type EventEvidenceDisplay = {
  570. /**
  571. * Used for alerting, probably not useful for the UI
  572. */
  573. important: boolean;
  574. name: string;
  575. value: string;
  576. };
  577. type EventOccurrence = {
  578. detectionTime: string;
  579. eventId: string;
  580. /**
  581. * Arbitrary data that vertical teams can pass to assist with rendering the page.
  582. * This is intended mostly for use with customizing the UI, not in the generic UI.
  583. */
  584. evidenceData: Record<string, any>;
  585. /**
  586. * Data displayed in the evidence table. Used in all issue types besides errors.
  587. */
  588. evidenceDisplay: EventEvidenceDisplay[];
  589. fingerprint: string[];
  590. id: string;
  591. issueTitle: string;
  592. resourceId: string;
  593. subtitle: string;
  594. type: number;
  595. };
  596. interface EventBase {
  597. contexts: EventContexts;
  598. crashFile: IssueAttachment | null;
  599. culprit: string;
  600. dateReceived: string;
  601. dist: string | null;
  602. entries: Entry[];
  603. errors: any[];
  604. eventID: string;
  605. fingerprints: string[];
  606. id: string;
  607. location: string | null;
  608. message: string;
  609. metadata: EventMetadata;
  610. occurrence: EventOccurrence | null;
  611. projectID: string;
  612. size: number;
  613. tags: EventTag[];
  614. title: string;
  615. type:
  616. | EventOrGroupType.CSP
  617. | EventOrGroupType.DEFAULT
  618. | EventOrGroupType.EXPECTCT
  619. | EventOrGroupType.EXPECTSTAPLE
  620. | EventOrGroupType.HPKP;
  621. user: EventUser | null;
  622. _meta?: Record<string, any>;
  623. context?: Record<string, any>;
  624. dateCreated?: string;
  625. device?: Record<string, any>;
  626. endTimestamp?: number;
  627. groupID?: string;
  628. groupingConfig?: {
  629. enhancements: string;
  630. id: string;
  631. };
  632. issueCategory?: IssueCategory;
  633. latestEventID?: string | null;
  634. measurements?: Record<string, Measurement>;
  635. nextEventID?: string | null;
  636. oldestEventID?: string | null;
  637. packages?: Record<string, string>;
  638. platform?: PlatformType;
  639. previousEventID?: string | null;
  640. projectSlug?: string;
  641. release?: Release | null;
  642. sdk?: {
  643. name: string;
  644. version: string;
  645. } | null;
  646. sdkUpdates?: Array<SDKUpdatesSuggestion>;
  647. userReport?: any;
  648. }
  649. interface TraceEventContexts extends EventContexts {
  650. browser?: BrowserContext;
  651. profile?: ProfileContext;
  652. }
  653. export interface EventTransaction
  654. extends Omit<EventBase, 'entries' | 'type' | 'contexts'> {
  655. contexts: TraceEventContexts;
  656. endTimestamp: number;
  657. // EntryDebugMeta is required for profiles to render in the span
  658. // waterfall with the correct symbolication statuses
  659. entries: (EntrySpans | EntryRequest | EntryDebugMeta)[];
  660. startTimestamp: number;
  661. type: EventOrGroupType.TRANSACTION;
  662. perfProblem?: PerformanceDetectorData;
  663. }
  664. export interface EventError extends Omit<EventBase, 'entries' | 'type'> {
  665. entries: (
  666. | EntryException
  667. | EntryStacktrace
  668. | EntryRequest
  669. | EntryThreads
  670. | EntryDebugMeta
  671. )[];
  672. type: EventOrGroupType.ERROR;
  673. }
  674. export type Event = EventError | EventTransaction | EventBase;
  675. // Response from EventIdLookupEndpoint
  676. // /organizations/${orgSlug}/eventids/${eventId}/
  677. export type EventIdResponse = {
  678. event: Event;
  679. eventId: string;
  680. groupId: string;
  681. organizationSlug: string;
  682. projectSlug: string;
  683. };