@@ -108,23 +108,44 @@ getGlobal().measurements = {
108
108
getMeasurements,
109
109
} ;
110
110
111
- const MEASUREMENT_API = `https://30vlq6h5qc.execute-api.eu-west-1.amazonaws.com/prod/metrics ` ;
111
+ const MEASUREMENT_API = `https://col.ops.csb.dev/data/sandpack ` ;
112
112
113
113
export function persistMeasurements ( data : {
114
114
sandboxId : string ;
115
115
cacheUsed : boolean ;
116
116
browser : string ;
117
117
version : string ;
118
118
} ) {
119
+ const body = [
120
+ {
121
+ measurement : 'load_times' ,
122
+ tags : {
123
+ browser : data . browser ,
124
+ sandbox_id : data . sandboxId ,
125
+ cache_used : data . cacheUsed ,
126
+ version : data . version ,
127
+ } ,
128
+ fields : {
129
+ transpilation : measurements . transpilation ,
130
+ evaluation : measurements . evaluation ,
131
+ external_resources : measurements [ 'external-resources' ] ,
132
+ compilation : measurements . compilation ,
133
+ boot : measurements . boot ,
134
+ total : measurements . total ,
135
+ dependencies : measurements . dependencies ,
136
+ } ,
137
+ } ,
138
+ ] ;
139
+
119
140
if ( process . env . NODE_ENV === 'development' || process . env . STAGING ) {
141
+ // eslint-disable-next-line
142
+ console . log ( body ) ;
120
143
return Promise . resolve ( ) ;
121
144
}
122
145
123
- const finalData = { ...data , ...measurements } ;
124
-
125
146
return fetch ( MEASUREMENT_API , {
126
147
method : 'POST' ,
127
- body : JSON . stringify ( finalData ) ,
148
+ body : JSON . stringify ( body ) ,
128
149
headers : {
129
150
Accept : 'application/json' ,
130
151
'Content-Type' : 'application/json' ,
0 commit comments