@@ -150,8 +150,9 @@ export class ExecutionStore {
150150 : 0 ;
151151
152152 const dataPoint = {
153- indexes : [ record . organizationId , record . id ] ,
153+ indexes : [ record . organizationId ] ,
154154 blobs : [
155+ record . id ,
155156 record . workflowId ,
156157 record . deploymentId || "" ,
157158 record . status ,
@@ -171,11 +172,19 @@ export class ExecutionStore {
171172 } )
172173 ) ;
173174
174- this . env . EXECUTIONS . writeDataPoint ( dataPoint ) ;
175-
176- console . log (
177- `ExecutionStore.writeToAnalytics: Successfully called writeDataPoint for ${ record . id } `
178- ) ;
175+ try {
176+ this . env . EXECUTIONS . writeDataPoint ( dataPoint ) ;
177+ console . log (
178+ `ExecutionStore.writeToAnalytics: Successfully called writeDataPoint for ${ record . id } `
179+ ) ;
180+ } catch ( writeError ) {
181+ console . error (
182+ `ExecutionStore.writeToAnalytics: writeDataPoint failed for ${ record . id } :` ,
183+ writeError ,
184+ { dataPoint : JSON . stringify ( dataPoint ) }
185+ ) ;
186+ throw writeError ;
187+ }
179188 } catch ( error ) {
180189 console . error (
181190 `ExecutionStore.writeToAnalytics: Failed to write ${ record . id } :` ,
@@ -272,7 +281,7 @@ export class ExecutionStore {
272281 SELECT *
273282 FROM ${ dataset }
274283 WHERE index1 = '${ organizationId } '
275- AND index2 = '${ id } '
284+ AND blob1 = '${ id } '
276285 ORDER BY timestamp DESC
277286 LIMIT 1
278287 ` ;
@@ -290,16 +299,16 @@ export class ExecutionStore {
290299 const timestamp = new Date ( row . timestamp ) ;
291300
292301 console . log (
293- `ExecutionStore.readFromAnalytics: Found execution ${ id } with status ${ row . blob3 } `
302+ `ExecutionStore.readFromAnalytics: Found execution ${ id } with status ${ row . blob4 } `
294303 ) ;
295304
296305 return {
297- id : row . index2 ,
298- workflowId : row . blob1 ,
299- deploymentId : row . blob2 || null ,
306+ id : row . blob1 ,
307+ workflowId : row . blob2 ,
308+ deploymentId : row . blob3 || null ,
300309 organizationId : row . index1 ,
301- status : row . blob3 as ExecutionStatusType ,
302- error : row . blob4 || null ,
310+ status : row . blob4 as ExecutionStatusType ,
311+ error : row . blob5 || null ,
303312 startedAt : timestamp ,
304313 endedAt : timestamp ,
305314 createdAt : timestamp ,
@@ -327,11 +336,11 @@ export class ExecutionStore {
327336 const whereConditions = [ `index1 = '${ organizationId } '` ] ;
328337
329338 if ( options ?. workflowId ) {
330- whereConditions . push ( `blob1 = '${ options . workflowId } '` ) ;
339+ whereConditions . push ( `blob2 = '${ options . workflowId } '` ) ;
331340 }
332341
333342 if ( options ?. deploymentId ) {
334- whereConditions . push ( `blob2 = '${ options . deploymentId } '` ) ;
343+ whereConditions . push ( `blob3 = '${ options . deploymentId } '` ) ;
335344 }
336345
337346 const limit = options ?. limit ?? 20 ;
@@ -358,12 +367,12 @@ export class ExecutionStore {
358367 return rows . map ( ( row ) => {
359368 const timestamp = new Date ( row . timestamp ) ;
360369 return {
361- id : row . index2 ,
362- workflowId : row . blob1 ,
363- deploymentId : row . blob2 || null ,
370+ id : row . blob1 ,
371+ workflowId : row . blob2 ,
372+ deploymentId : row . blob3 || null ,
364373 organizationId : row . index1 ,
365- status : row . blob3 as ExecutionStatusType ,
366- error : row . blob4 || null ,
374+ status : row . blob4 as ExecutionStatusType ,
375+ error : row . blob5 || null ,
367376 startedAt : timestamp ,
368377 endedAt : timestamp ,
369378 createdAt : timestamp ,
0 commit comments