File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
codewhispererChat/controllers/chat Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { InsertedCode } from '../../codewhispererChat/controllers/chat/model'
15
15
import { codeWhispererClient } from '../client/codewhisperer'
16
16
import { logSendTelemetryEventFailure } from '../../codewhispererChat/controllers/chat/telemetryHelper'
17
17
import { Timeout } from '../../shared/utilities/timeoutUtils'
18
+ import { activeCustomizationOrNull } from '../util/customizationUtil'
18
19
19
20
/**
20
21
* This singleton class is mainly used for calculating the percentage of user modification.
@@ -88,6 +89,8 @@ export class CodeWhispererTracker {
88
89
89
90
public async emitTelemetryOnSuggestion ( suggestion : AcceptedSuggestionEntry | InsertedCode ) {
90
91
let percentage = 1.0
92
+ const customization = activeCustomizationOrNull ( )
93
+
91
94
try {
92
95
if ( suggestion . fileUrl ?. scheme !== '' ) {
93
96
const document = await vscode . workspace . openTextDocument ( suggestion . fileUrl )
@@ -118,6 +121,7 @@ export class CodeWhispererTracker {
118
121
conversationId : event . cwsprChatConversationId ,
119
122
messageId : event . cwsprChatMessageId ,
120
123
modificationPercentage : event . cwsprChatModificationPercentage ,
124
+ customizationArn : customization ?. arn ,
121
125
} ,
122
126
} ,
123
127
} )
Original file line number Diff line number Diff line change @@ -122,6 +122,16 @@ export const getSelectedCustomization = (): Customization => {
122
122
}
123
123
}
124
124
125
+ // codewhisperer service will throw validation exception if arn is empty string, thus we need to specifically pass undefined if it's base customization
126
+ export function activeCustomizationOrNull ( ) : Customization | undefined {
127
+ const customization = getSelectedCustomization ( )
128
+ if ( customization === baseCustomization ) {
129
+ return undefined
130
+ }
131
+
132
+ return customization
133
+ }
134
+
125
135
export const setSelectedCustomization = async ( customization : Customization ) => {
126
136
if ( ! AuthUtil . instance . isValidEnterpriseSsoInUse ( ) || ! AuthUtil . instance . conn ) {
127
137
return
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import { isAwsError } from '../../../shared/errors'
34
34
import { ChatMessageInteractionType } from '../../../codewhisperer/client/codewhispereruserclient'
35
35
import { supportedLanguagesList } from '../chat/chatRequest/converter'
36
36
import { AuthUtil } from '../../../codewhisperer/util/authUtil'
37
+ import { activeCustomizationOrNull } from '../../../codewhisperer/util/customizationUtil'
37
38
38
39
export function logSendTelemetryEventFailure ( error : any ) {
39
40
let requestId : string | undefined
@@ -258,6 +259,7 @@ export class CWCTelemetryHelper {
258
259
acceptedLineCount : event . cwsprChatAcceptedNumberOfLines ,
259
260
acceptedSnippetHasReference : false ,
260
261
hasProjectLevelContext : this . responseWithProjectContext . get ( event . cwsprChatMessageId ) ,
262
+ customizationArn : activeCustomizationOrNull ( ) ?. arn ,
261
263
} ,
262
264
} ,
263
265
} )
@@ -381,6 +383,7 @@ export class CWCTelemetryHelper {
381
383
hasProjectLevelContext : triggerPayload . relevantTextDocuments
382
384
? triggerPayload . relevantTextDocuments . length > 0
383
385
: false ,
386
+ customizationArn : activeCustomizationOrNull ( ) ?. arn ,
384
387
} ,
385
388
} ,
386
389
} )
You can’t perform that action at this time.
0 commit comments