File tree Expand file tree Collapse file tree 3 files changed +46
-14
lines changed
amazonqFeatureDev/controllers/chat
test/amazonqFeatureDev/controllers/chat Expand file tree Collapse file tree 3 files changed +46
-14
lines changed Original file line number Diff line number Diff line change @@ -749,21 +749,24 @@ export class FeatureDevController {
749749 }
750750
751751 private async stopResponse ( message : any ) {
752- this . messenger . sendAnswer ( {
753- message : i18n ( 'AWS.amazonq.featureDev.pillText.stoppingCodeGeneration' ) ,
754- type : 'answer-part' ,
755- tabID : message . tabID ,
756- } )
757- this . messenger . sendUpdatePlaceholder (
758- message . tabID ,
759- i18n ( 'AWS.amazonq.featureDev.pillText.stoppingCodeGeneration' )
760- )
761- this . messenger . sendChatInputEnabled ( message . tabID , false )
752+ await telemetry . amazonq_stopCodeGeneration . run ( async ( span ) => {
753+ span . record ( { tabID : message . tabID } )
754+ this . messenger . sendAnswer ( {
755+ message : i18n ( 'AWS.amazonq.featureDev.pillText.stoppingCodeGeneration' ) ,
756+ type : 'answer-part' ,
757+ tabID : message . tabID ,
758+ } )
759+ this . messenger . sendUpdatePlaceholder (
760+ message . tabID ,
761+ i18n ( 'AWS.amazonq.featureDev.pillText.stoppingCodeGeneration' )
762+ )
763+ this . messenger . sendChatInputEnabled ( message . tabID , false )
762764
763- const session = await this . sessionStorage . getSession ( message . tabID )
764- if ( session . state ?. tokenSource ) {
765- session . state ?. tokenSource ?. cancel ( )
766- }
765+ const session = await this . sessionStorage . getSession ( message . tabID )
766+ if ( session . state ?. tokenSource ) {
767+ session . state ?. tokenSource ?. cancel ( )
768+ }
769+ } )
767770 }
768771
769772 private async tabOpened ( message : any ) {
Original file line number Diff line number Diff line change 358358 "name" : " amazonqMessageDisplayedMs" ,
359359 "type" : " int" ,
360360 "description" : " Duration between the partner teams code receiving the message and when the message was finally displayed in ms"
361+ },
362+ {
363+ "name" : " tabID" ,
364+ "type" : " string" ,
365+ "description" : " The unique identifier of a tab"
361366 }
362367 ],
363368 "metrics" : [
12601265 "required" : false
12611266 }
12621267 ]
1268+ },
1269+ {
1270+ "name" : " amazonq_stopCodeGeneration" ,
1271+ "description" : " User stopped the code generation" ,
1272+ "metadata" : [
1273+ {
1274+ "type" : " tabID" ,
1275+ "required" : true
1276+ }
1277+ ]
12631278 }
12641279 ]
12651280}
Original file line number Diff line number Diff line change @@ -404,4 +404,18 @@ describe('Controller', () => {
404404 } )
405405 } )
406406 } )
407+
408+ describe ( 'stopResponse' , ( ) => {
409+ it ( 'should emit amazonq_stopCodeGeneration telemetry' , async ( ) => {
410+ const getSessionStub = sinon . stub ( controllerSetup . sessionStorage , 'getSession' ) . resolves ( session )
411+ controllerSetup . emitters . stopResponse . fire ( { tabID, conversationID } )
412+ await waitUntil ( ( ) => {
413+ return Promise . resolve ( getSessionStub . callCount > 0 )
414+ } , { } )
415+ assertTelemetry ( 'amazonq_stopCodeGeneration' , {
416+ tabID : tabID ,
417+ result : 'Succeeded' ,
418+ } )
419+ } )
420+ } )
407421} )
You can’t perform that action at this time.
0 commit comments