event.tsx 20 KB

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