File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,7 @@ class CubejsServerCore {
323
323
initAgent ( ) {
324
324
if ( process . env . CUBEJS_AGENT_ENDPOINT_URL ) {
325
325
const oldLogger = this . logger ;
326
+ this . preAgentLogger = oldLogger ;
326
327
this . logger = ( msg , params ) => {
327
328
oldLogger ( msg , params ) ;
328
329
agentCollect (
@@ -337,6 +338,16 @@ class CubejsServerCore {
337
338
}
338
339
}
339
340
341
+ async flushAgent ( ) {
342
+ if ( process . env . CUBEJS_AGENT_ENDPOINT_URL ) {
343
+ await agentCollect (
344
+ { msg : 'Flush Agent' } ,
345
+ process . env . CUBEJS_AGENT_ENDPOINT_URL ,
346
+ this . preAgentLogger
347
+ ) ;
348
+ }
349
+ }
350
+
340
351
static create ( options ) {
341
352
return new CubejsServerCore ( options ) ;
342
353
}
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class AWSHandlers extends Handlers {
29
29
const message = JSON . parse ( record . Sns . Message ) ;
30
30
await this . processMessage ( message ) ;
31
31
} ) ) ;
32
+ await this . serverCore . flushAgent ( ) ;
32
33
} else {
33
34
this . serverCore . logger ( 'Invalid Lambda Process Message' , {
34
35
warning : `Event doesn't contain Records field. Skipping.` ,
You can’t perform that action at this time.
0 commit comments