@@ -108,23 +108,44 @@ getGlobal().measurements = {
108108 getMeasurements,
109109} ;
110110
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 ` ;
112112
113113export function persistMeasurements ( data : {
114114 sandboxId : string ;
115115 cacheUsed : boolean ;
116116 browser : string ;
117117 version : string ;
118118} ) {
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+
119140 if ( process . env . NODE_ENV === 'development' || process . env . STAGING ) {
141+ // eslint-disable-next-line
142+ console . log ( body ) ;
120143 return Promise . resolve ( ) ;
121144 }
122145
123- const finalData = { ...data , ...measurements } ;
124-
125146 return fetch ( MEASUREMENT_API , {
126147 method : 'POST' ,
127- body : JSON . stringify ( finalData ) ,
148+ body : JSON . stringify ( body ) ,
128149 headers : {
129150 Accept : 'application/json' ,
130151 'Content-Type' : 'application/json' ,
0 commit comments