Browse Source

ref(contexts): Update Runtime Context to latest spec (#41650)

https://develop.sentry.dev/sdk/event-payloads/contexts/#runtime-context

https://github.com/getsentry/relay/blob/master/relay-general/src/protocol/contexts/runtime.rs
Abhijeet Prasad 2 years ago
parent
commit
5aede2467a
1 changed files with 16 additions and 6 deletions
  1. 16 6
      static/app/types/event.tsx

+ 16 - 6
static/app/types/event.tsx

@@ -453,13 +453,23 @@ export interface DeviceContext
   timezone?: string;
 }
 
-type RuntimeContext = {
+enum RuntimeContextKey {
+  BUILD = 'build',
+  NAME = 'name',
+  RAW_DESCRIPTION = 'raw_description',
+  VERSION = 'version',
+}
+
+// https://develop.sentry.dev/sdk/event-payloads/contexts/#runtime-context
+interface RuntimeContext
+  extends Partial<Record<RuntimeContextKey, unknown>>,
+    BaseContext {
   type: 'runtime';
-  build?: string;
-  name?: string;
-  raw_description?: string;
-  version?: number;
-};
+  [RuntimeContextKey.BUILD]?: string;
+  [RuntimeContextKey.NAME]?: string;
+  [RuntimeContextKey.RAW_DESCRIPTION]?: string;
+  [RuntimeContextKey.VERSION]?: number;
+}
 
 type OSContext = {
   build: string;