File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
libs/core-functions/src/functions/lib Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ export type FuncChainResult = {
77
77
} ;
78
78
79
79
export type FunctionExecRes = {
80
- receivedAt ?: any ;
80
+ receivedAt ?: Date ;
81
81
eventIndex : number ;
82
82
event ?: any ;
83
83
metricsMeta ?: MetricsMeta ;
Original file line number Diff line number Diff line change @@ -288,10 +288,10 @@ export async function runChain(
288
288
const event = events [ i ] ;
289
289
let result : FuncReturn = undefined ;
290
290
const sw = stopwatch ( ) ;
291
- const rat = new Date ( event . receivedAt ) as any ;
291
+ const rat = new Date ( event . receivedAt ) ;
292
292
const execLogMeta = {
293
293
eventIndex : i ,
294
- receivedAt : rat && rat != "Invalid Date" ? rat : new Date ( ) ,
294
+ receivedAt : ! isNaN ( rat . getTime ( ) ) ? rat : new Date ( ) ,
295
295
functionId : f . id ,
296
296
metricsMeta : metricsMeta ,
297
297
} ;
Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ export function createMetrics(
69
69
value : JSON . stringify ( {
70
70
timestamp : d ,
71
71
workspaceId : m . workspaceId ,
72
- messageId : m . messageId ,
72
+ // to count active events use composed key: messageId_eventIndex_receivedAt
73
+ messageId : m . key ,
73
74
} ) ,
74
75
} ;
75
76
} ) ,
@@ -183,7 +184,7 @@ export function createMetrics(
183
184
return prefix + status ;
184
185
} ) ( el ) ;
185
186
buffer . push ( {
186
- key : crypto . randomUUID ( ) ,
187
+ key : el . metricsMeta . messageId + "_" + el . eventIndex + "_" + d . getTime ( ) ,
187
188
timestamp : d ,
188
189
...omit ( el . metricsMeta , "retries" ) ,
189
190
functionId : el . functionId ,
You can’t perform that action at this time.
0 commit comments