Skip to content

Commit b05213b

Browse files
authored
AmazonQ: Add cwsprCredentialStartUrl field to chat telemetry events (#4439)
The new field contains the start URL of the current SSO connection. This will allow tracing back chat events to the originating SSO session.
1 parent e3038d4 commit b05213b

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

packages/toolkit/src/codewhispererChat/controllers/chat/telemetryHelper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { codeWhispererClient } from '../../../codewhisperer/client/codewhisperer
3434
import { isAwsError } from '../../../shared/errors'
3535
import { ChatMessageInteractionType } from '../../../codewhisperer/client/codewhispereruserclient'
3636
import { supportedLanguagesList } from '../chat/chatRequest/converter'
37+
import { AuthUtil } from '../../../codewhisperer/util/authUtil'
3738

3839
const performance = globalThis.performance ?? require('perf_hooks').performance
3940

@@ -149,6 +150,7 @@ export class CWCTelemetryHelper {
149150
message = message as InsertCodeAtCursorPosition
150151
event = {
151152
cwsprChatConversationId: conversationId ?? '',
153+
credentialStartUrl: AuthUtil.instance.startUrl,
152154
cwsprChatMessageId: message.messageId,
153155
cwsprChatInteractionType: 'insertAtCursor',
154156
cwsprChatAcceptedCharactersLength: message.code.length,
@@ -160,6 +162,7 @@ export class CWCTelemetryHelper {
160162
message = message as CopyCodeToClipboard
161163
event = {
162164
cwsprChatConversationId: conversationId ?? '',
165+
credentialStartUrl: AuthUtil.instance.startUrl,
163166
cwsprChatMessageId: message.messageId,
164167
cwsprChatInteractionType: 'copySnippet',
165168
cwsprChatAcceptedCharactersLength: message.code.length,
@@ -171,6 +174,7 @@ export class CWCTelemetryHelper {
171174
message = message as PromptMessage
172175
event = {
173176
cwsprChatConversationId: conversationId ?? '',
177+
credentialStartUrl: AuthUtil.instance.startUrl,
174178
cwsprChatMessageId: message.messageId,
175179
cwsprChatInteractionType: 'clickFollowUp',
176180
}
@@ -180,6 +184,7 @@ export class CWCTelemetryHelper {
180184
event = {
181185
cwsprChatMessageId: message.messageId,
182186
cwsprChatConversationId: conversationId ?? '',
187+
credentialStartUrl: AuthUtil.instance.startUrl,
183188
cwsprChatInteractionType: message.vote,
184189
}
185190
break
@@ -188,6 +193,7 @@ export class CWCTelemetryHelper {
188193
event = {
189194
cwsprChatMessageId: message.messageId,
190195
cwsprChatConversationId: conversationId ?? '',
196+
credentialStartUrl: AuthUtil.instance.startUrl,
191197
cwsprChatInteractionType: 'clickLink',
192198
cwsprChatInteractionTarget: message.link,
193199
}
@@ -197,6 +203,7 @@ export class CWCTelemetryHelper {
197203
event = {
198204
cwsprChatMessageId: message.messageId,
199205
cwsprChatConversationId: conversationId ?? '',
206+
credentialStartUrl: AuthUtil.instance.startUrl,
200207
cwsprChatInteractionType: 'clickBodyLink',
201208
cwsprChatInteractionTarget: message.link,
202209
}
@@ -206,6 +213,7 @@ export class CWCTelemetryHelper {
206213
event = {
207214
cwsprChatMessageId: 'footer',
208215
cwsprChatConversationId: conversationId ?? '',
216+
credentialStartUrl: AuthUtil.instance.startUrl,
209217
cwsprChatInteractionType: 'clickBodyLink',
210218
cwsprChatInteractionTarget: message.link,
211219
}

packages/toolkit/src/shared/telemetry/vscodeTelemetry.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,10 @@
624624
{
625625
"type": "cwsprChatConversationId"
626626
},
627+
{
628+
"type": "credentialStartUrl",
629+
"required": false
630+
},
627631
{
628632
"type": "cwsprChatTriggerInteraction"
629633
},
@@ -651,6 +655,10 @@
651655
{
652656
"type": "cwsprChatConversationId"
653657
},
658+
{
659+
"type": "credentialStartUrl",
660+
"required": false
661+
},
654662
{
655663
"type": "cwsprChatMessageId"
656664
},
@@ -725,6 +733,10 @@
725733
"type": "cwsprChatConversationId",
726734
"required": false
727735
},
736+
{
737+
"type": "credentialStartUrl",
738+
"required": false
739+
},
728740
{
729741
"type": "cwsprChatTriggerInteraction"
730742
},
@@ -770,6 +782,10 @@
770782
{
771783
"type": "cwsprChatConversationId"
772784
},
785+
{
786+
"type": "credentialStartUrl",
787+
"required": false
788+
},
773789
{
774790
"type": "cwsprChatMessageId"
775791
},
@@ -797,6 +813,10 @@
797813
{
798814
"type": "cwsprChatConversationId"
799815
},
816+
{
817+
"type": "credentialStartUrl",
818+
"required": false
819+
},
800820
{
801821
"type": "cwsprChatMessageId"
802822
},
@@ -811,6 +831,10 @@
811831
"metadata": [
812832
{
813833
"type": "cwsprChatConversationId"
834+
},
835+
{
836+
"type": "credentialStartUrl",
837+
"required": false
814838
}
815839
]
816840
},
@@ -820,6 +844,10 @@
820844
"metadata": [
821845
{
822846
"type": "cwsprChatConversationId"
847+
},
848+
{
849+
"type": "credentialStartUrl",
850+
"required": false
823851
}
824852
]
825853
},

0 commit comments

Comments
 (0)