@@ -337,12 +337,12 @@ export class AtlasService {
337337 log . info ( mongoLogId ( 1_001_000_218 ) , 'AtlasService' , 'Starting sign in' ) ;
338338
339339 try {
340+ const userInfo = await this . getUserInfo ( { signal } ) ;
340341 log . info (
341342 mongoLogId ( 1_001_000_219 ) ,
342343 'AtlasService' ,
343344 'Signed in successfully'
344345 ) ;
345- const userInfo = await this . getUserInfo ( { signal } ) ;
346346 track ( 'Atlas Sign In Success' , getTrackingUserInfo ( userInfo ) ) ;
347347 return userInfo ;
348348 } catch ( err ) {
@@ -544,11 +544,17 @@ export class AtlasService {
544544 throwIfNetworkTrafficDisabled ( ) ;
545545
546546 const userId = ( await this . getActiveCompassUser ( ) ) . id ;
547+ const url = `${ this . config . atlasApiUnauthBaseUrl } /ai/api/v1/hello/${ userId } ` ;
547548
548- const res = await this . fetch (
549- `${ this . config . atlasApiUnauthBaseUrl } /ai/api/v1/hello/${ userId } `
549+ log . info (
550+ mongoLogId ( 1_001_000_227 ) ,
551+ 'AtlasService' ,
552+ 'Fetching if the AI feature is enabled via hello endpoint' ,
553+ { userId, url }
550554 ) ;
551555
556+ const res = await this . fetch ( url ) ;
557+
552558 await throwIfNotOk ( res ) ;
553559
554560 const body = await res . json ( ) ;
@@ -559,12 +565,6 @@ export class AtlasService {
559565 }
560566
561567 static async setupAIAccess ( ) : Promise < void > {
562- log . info (
563- mongoLogId ( 1_001_000_227 ) ,
564- 'AtlasService' ,
565- 'Fetching if the AI feature is enabled'
566- ) ;
567-
568568 try {
569569 throwIfNetworkTrafficDisabled ( ) ;
570570
@@ -579,6 +579,7 @@ export class AtlasService {
579579 'Fetched if the AI feature is enabled' ,
580580 {
581581 enabled : isAIFeatureEnabled ,
582+ featureResponse,
582583 }
583584 ) ;
584585
@@ -644,18 +645,30 @@ export class AtlasService {
644645 }
645646
646647 const token = await this . maybeGetToken ( { signal } ) ;
648+ const url = `${ this . config . atlasApiBaseUrl } /ai/api/v1/mql-aggregation` ;
647649
648- const res = await this . fetch (
649- `${ this . config . atlasApiBaseUrl } /ai/api/v1/mql-aggregation` ,
650- {
651- signal : signal as NodeFetchAbortSignal | undefined ,
652- method : 'POST' ,
653- headers : {
654- Authorization : `Bearer ${ token ?? '' } ` ,
655- 'Content-Type' : 'application/json' ,
656- } ,
657- body : msgBody ,
658- }
650+ log . info (
651+ mongoLogId ( 1_001_000_247 ) ,
652+ 'AtlasService' ,
653+ 'Running aggregation generation request' ,
654+ { url, body : msgBody }
655+ ) ;
656+
657+ const res = await this . fetch ( url , {
658+ signal : signal as NodeFetchAbortSignal | undefined ,
659+ method : 'POST' ,
660+ headers : {
661+ Authorization : `Bearer ${ token ?? '' } ` ,
662+ 'Content-Type' : 'application/json' ,
663+ } ,
664+ body : msgBody ,
665+ } ) ;
666+
667+ log . info (
668+ mongoLogId ( 1_001_000_248 ) ,
669+ 'AtlasService' ,
670+ 'Received aggregation generation response' ,
671+ { status : res . status , statusText : res . statusText }
659672 ) ;
660673
661674 await throwIfNotOk ( res ) ;
@@ -713,18 +726,30 @@ export class AtlasService {
713726 }
714727
715728 const token = await this . maybeGetToken ( { signal } ) ;
729+ const url = `${ this . config . atlasApiBaseUrl } /ai/api/v1/mql-query` ;
716730
717- const res = await this . fetch (
718- `${ this . config . atlasApiBaseUrl } /ai/api/v1/mql-query` ,
719- {
720- signal : signal as NodeFetchAbortSignal | undefined ,
721- method : 'POST' ,
722- headers : {
723- Authorization : `Bearer ${ token ?? '' } ` ,
724- 'Content-Type' : 'application/json' ,
725- } ,
726- body : msgBody ,
727- }
731+ log . info (
732+ mongoLogId ( 1_001_000_249 ) ,
733+ 'AtlasService' ,
734+ 'Running query generation request' ,
735+ { url, body : msgBody }
736+ ) ;
737+
738+ const res = await this . fetch ( url , {
739+ signal : signal as NodeFetchAbortSignal | undefined ,
740+ method : 'POST' ,
741+ headers : {
742+ Authorization : `Bearer ${ token ?? '' } ` ,
743+ 'Content-Type' : 'application/json' ,
744+ } ,
745+ body : msgBody ,
746+ } ) ;
747+
748+ log . info (
749+ mongoLogId ( 1_001_000_250 ) ,
750+ 'AtlasService' ,
751+ 'Received query generation response' ,
752+ { status : res . status , statusText : res . statusText }
728753 ) ;
729754
730755 await throwIfNotOk ( res ) ;
0 commit comments