event.tsx 19 KB

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