MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / normalizeEvent

Function normalizeEvent

packages/deno/test/normalize.ts:69–207  ·  view source on GitHub ↗

* Normalizes an event so that in can be compared to an expected event * * All properties that are timestamps, versions, ids or variables that may vary * by platform are replaced with placeholder strings

(event: Event)

Source from the content-addressed store, hash-verified

67 * by platform are replaced with placeholder strings
68 */
69function normalizeEvent(event: Event): Event {
70 if (event.sdk?.version) {
71 event.sdk.version = '{{version}}';
72 }
73
74 if (event?.sdk?.packages) {
75 for (const pkg of event.sdk.packages) {
76 if (pkg.version) {
77 pkg.version = '{{version}}';
78 }
79 }
80 }
81
82 if (event.contexts?.app?.app_start_time) {
83 event.contexts.app.app_start_time = '{{time}}';
84 }
85
86 if (event.contexts?.typescript?.version) {
87 event.contexts.typescript.version = '{{version}}';
88 }
89
90 if (event.contexts?.v8?.version) {
91 event.contexts.v8.version = '{{version}}';
92 }
93
94 if (event.contexts?.runtime) {
95 if (event.contexts.runtime?.version) {
96 event.contexts.runtime.version = '{{version}}';
97 }
98 }
99
100 if (event.contexts?.device?.arch) {
101 event.contexts.device.arch = '{{arch}}';
102 }
103
104 if (event.contexts?.device?.memory_size) {
105 event.contexts.device.memory_size = 0;
106 }
107
108 if (event.contexts?.device?.free_memory) {
109 event.contexts.device.free_memory = 0;
110 }
111
112 if (event.contexts?.device?.processor_count) {
113 event.contexts.device.processor_count = 0;
114 }
115
116 if (event.contexts?.device?.processor_frequency) {
117 event.contexts.device.processor_frequency = 0;
118 }
119
120 if (event.contexts?.device?.cpu_description) {
121 event.contexts.device.cpu_description = '{{cpu}}';
122 }
123
124 if (event.contexts?.device?.screen_resolution) {
125 event.contexts.device.screen_resolution = '{{screen}}';
126 }

Callers 1

normalizeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected