event.tsx 20 KB

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