@@ -337,12 +337,12 @@ export class AtlasService {
337
337
log . info ( mongoLogId ( 1_001_000_218 ) , 'AtlasService' , 'Starting sign in' ) ;
338
338
339
339
try {
340
+ const userInfo = await this . getUserInfo ( { signal } ) ;
340
341
log . info (
341
342
mongoLogId ( 1_001_000_219 ) ,
342
343
'AtlasService' ,
343
344
'Signed in successfully'
344
345
) ;
345
- const userInfo = await this . getUserInfo ( { signal } ) ;
346
346
track ( 'Atlas Sign In Success' , getTrackingUserInfo ( userInfo ) ) ;
347
347
return userInfo ;
348
348
} catch ( err ) {
@@ -544,11 +544,17 @@ export class AtlasService {
544
544
throwIfNetworkTrafficDisabled ( ) ;
545
545
546
546
const userId = ( await this . getActiveCompassUser ( ) ) . id ;
547
+ const url = `${ this . config . atlasApiUnauthBaseUrl } /ai/api/v1/hello/${ userId } ` ;
547
548
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 }
550
554
) ;
551
555
556
+ const res = await this . fetch ( url ) ;
557
+
552
558
await throwIfNotOk ( res ) ;
553
559
554
560
const body = await res . json ( ) ;
@@ -559,12 +565,6 @@ export class AtlasService {
559
565
}
560
566
561
567
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
-
568
568
try {
569
569
throwIfNetworkTrafficDisabled ( ) ;
570
570
@@ -579,6 +579,7 @@ export class AtlasService {
579
579
'Fetched if the AI feature is enabled' ,
580
580
{
581
581
enabled : isAIFeatureEnabled ,
582
+ featureResponse,
582
583
}
583
584
) ;
584
585
@@ -644,18 +645,30 @@ export class AtlasService {
644
645
}
645
646
646
647
const token = await this . maybeGetToken ( { signal } ) ;
648
+ const url = `${ this . config . atlasApiBaseUrl } /ai/api/v1/mql-aggregation` ;
647
649
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 }
659
672
) ;
660
673
661
674
await throwIfNotOk ( res ) ;
@@ -713,18 +726,30 @@ export class AtlasService {
713
726
}
714
727
715
728
const token = await this . maybeGetToken ( { signal } ) ;
729
+ const url = `${ this . config . atlasApiBaseUrl } /ai/api/v1/mql-query` ;
716
730
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 }
728
753
) ;
729
754
730
755
await throwIfNotOk ( res ) ;
0 commit comments