event.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  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. type EventContexts = {
  521. 'Memory Info'?: MemoryInfoContext;
  522. 'ThreadPool Info'?: ThreadPoolInfoContext;
  523. client_os?: OSContext;
  524. device?: DeviceContext;
  525. feedback?: Record<string, any>;
  526. memory_info?: MemoryInfoContext;
  527. os?: OSContext;
  528. otel?: OtelContext;
  529. // TODO (udameli): add better types here
  530. // once perf issue data shape is more clear
  531. performance_issue?: any;
  532. runtime?: RuntimeContext;
  533. threadpool_info?: ThreadPoolInfoContext;
  534. trace?: TraceContextType;
  535. unity?: UnityContext;
  536. };
  537. export type Measurement = {value: number; unit?: string};
  538. export type EventTag = {key: string; value: string};
  539. export type EventUser = {
  540. data?: string | null;
  541. email?: string;
  542. id?: string;
  543. ip_address?: string;
  544. name?: string | null;
  545. username?: string | null;
  546. };
  547. export type PerformanceDetectorData = {
  548. causeSpanIds: string[];
  549. offenderSpanIds: string[];
  550. parentSpanIds: string[];
  551. issueType?: IssueType;
  552. };
  553. type EventEvidenceDisplay = {
  554. /**
  555. * Used for alerting, probably not useful for the UI
  556. */
  557. important: boolean;
  558. name: string;
  559. value: string;
  560. };
  561. type EventOccurrence = {
  562. detectionTime: string;
  563. eventId: string;
  564. /**
  565. * Arbitrary data that vertical teams can pass to assist with rendering the page.
  566. * This is intended mostly for use with customizing the UI, not in the generic UI.
  567. */
  568. evidenceData: Record<string, any>;
  569. /**
  570. * Data displayed in the evidence table. Used in all issue types besides errors.
  571. */
  572. evidenceDisplay: EventEvidenceDisplay[];
  573. fingerprint: string[];
  574. id: string;
  575. issueTitle: string;
  576. resourceId: string;
  577. subtitle: string;
  578. };
  579. interface EventBase {
  580. contexts: EventContexts;
  581. crashFile: IssueAttachment | null;
  582. culprit: string;
  583. dateReceived: string;
  584. dist: string | null;
  585. entries: Entry[];
  586. errors: any[];
  587. eventID: string;
  588. fingerprints: string[];
  589. id: string;
  590. location: string | null;
  591. message: string;
  592. metadata: EventMetadata;
  593. occurrence: EventOccurrence | null;
  594. projectID: string;
  595. size: number;
  596. tags: EventTag[];
  597. title: string;
  598. type:
  599. | EventOrGroupType.CSP
  600. | EventOrGroupType.DEFAULT
  601. | EventOrGroupType.EXPECTCT
  602. | EventOrGroupType.EXPECTSTAPLE
  603. | EventOrGroupType.HPKP;
  604. user: EventUser | null;
  605. _meta?: Record<string, any>;
  606. context?: Record<string, any>;
  607. dateCreated?: string;
  608. device?: Record<string, any>;
  609. endTimestamp?: number;
  610. groupID?: string;
  611. groupingConfig?: {
  612. enhancements: string;
  613. id: string;
  614. };
  615. issueCategory?: IssueCategory;
  616. latestEventID?: string | null;
  617. measurements?: Record<string, Measurement>;
  618. nextEventID?: string | null;
  619. oldestEventID?: string | null;
  620. packages?: Record<string, string>;
  621. platform?: PlatformType;
  622. previousEventID?: string | null;
  623. projectSlug?: string;
  624. release?: Release | null;
  625. sdk?: {
  626. name: string;
  627. version: string;
  628. } | null;
  629. sdkUpdates?: Array<SDKUpdatesSuggestion>;
  630. userReport?: any;
  631. }
  632. interface TraceEventContexts extends EventContexts {
  633. trace?: TraceContextType;
  634. }
  635. export interface EventTransaction
  636. extends Omit<EventBase, 'entries' | 'type' | 'contexts'> {
  637. contexts: TraceEventContexts;
  638. endTimestamp: number;
  639. entries: (EntrySpans | EntryRequest)[];
  640. startTimestamp: number;
  641. type: EventOrGroupType.TRANSACTION;
  642. perfProblem?: PerformanceDetectorData;
  643. }
  644. export interface EventError extends Omit<EventBase, 'entries' | 'type'> {
  645. entries: (
  646. | EntryException
  647. | EntryStacktrace
  648. | EntryRequest
  649. | EntryThreads
  650. | EntryDebugMeta
  651. )[];
  652. type: EventOrGroupType.ERROR;
  653. }
  654. export type Event = EventError | EventTransaction | EventBase;
  655. // Response from EventIdLookupEndpoint
  656. // /organizations/${orgSlug}/eventids/${eventId}/
  657. export type EventIdResponse = {
  658. event: Event;
  659. eventId: string;
  660. groupId: string;
  661. organizationSlug: string;
  662. projectSlug: string;
  663. };