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 {
323323 initAgent ( ) {
324324 if ( process . env . CUBEJS_AGENT_ENDPOINT_URL ) {
325325 const oldLogger = this . logger ;
326+ this . preAgentLogger = oldLogger ;
326327 this . logger = ( msg , params ) => {
327328 oldLogger ( msg , params ) ;
328329 agentCollect (
@@ -337,6 +338,16 @@ class CubejsServerCore {
337338 }
338339 }
339340
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+
340351 static create ( options ) {
341352 return new CubejsServerCore ( options ) ;
342353 }
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class AWSHandlers extends Handlers {
2929 const message = JSON . parse ( record . Sns . Message ) ;
3030 await this . processMessage ( message ) ;
3131 } ) ) ;
32+ await this . serverCore . flushAgent ( ) ;
3233 } else {
3334 this . serverCore . logger ( 'Invalid Lambda Process Message' , {
3435 warning : `Event doesn't contain Records field. Skipping.` ,
You can’t perform that action at this time.
0 commit comments