@@ -24,23 +24,6 @@ interface CodeWhispererToken {
24
24
accepted : number
25
25
}
26
26
27
- interface UserInputDetail {
28
- count : number
29
- total : number
30
- }
31
-
32
- interface UserInputDetails {
33
- lt1 : UserInputDetail
34
- lt50 : UserInputDetail
35
- lt100 : UserInputDetail
36
- lt200 : UserInputDetail
37
- lt300 : UserInputDetail
38
- lt400 : UserInputDetail
39
- lt500 : UserInputDetail
40
- lt1000 : UserInputDetail
41
- gt1000 : UserInputDetail
42
- }
43
-
44
27
const autoClosingKeystrokeInputs = [ '[]' , '{}' , '()' , '""' , "''" ]
45
28
46
29
/**
@@ -54,25 +37,12 @@ export class CodeWhispererCodeCoverageTracker {
54
37
private _language : CodewhispererLanguage
55
38
private _serviceInvocationCount : number
56
39
57
- private _userInputDetails : UserInputDetails
58
-
59
40
private constructor ( language : CodewhispererLanguage ) {
60
41
this . _acceptedTokens = { }
61
42
this . _totalTokens = { }
62
43
this . _startTime = 0
63
44
this . _language = language
64
45
this . _serviceInvocationCount = 0
65
- this . _userInputDetails = {
66
- lt1 : { count : 0 , total : 0 } ,
67
- lt50 : { count : 0 , total : 0 } ,
68
- lt100 : { count : 0 , total : 0 } ,
69
- lt200 : { count : 0 , total : 0 } ,
70
- lt300 : { count : 0 , total : 0 } ,
71
- lt400 : { count : 0 , total : 0 } ,
72
- lt500 : { count : 0 , total : 0 } ,
73
- lt1000 : { count : 0 , total : 0 } ,
74
- gt1000 : { count : 0 , total : 0 } ,
75
- }
76
46
}
77
47
78
48
public get serviceInvocationCount ( ) : number {
@@ -150,7 +120,7 @@ export class CodeWhispererCodeCoverageTracker {
150
120
}
151
121
} )
152
122
}
153
- const percentCount = ( ( acceptedTokens / totalTokens ) * 100 ) . toFixed ( 2 )
123
+ const percentCount = ( ( unmodifiedAcceptedTokens / totalTokens ) * 100 ) . toFixed ( 2 )
154
124
const percentage = Math . round ( parseInt ( percentCount ) )
155
125
const selectedCustomization = getSelectedCustomization ( )
156
126
if ( this . _serviceInvocationCount <= 0 ) {
@@ -160,13 +130,13 @@ export class CodeWhispererCodeCoverageTracker {
160
130
telemetry . codewhisperer_codePercentage . emit ( {
161
131
codewhispererTotalTokens : totalTokens ,
162
132
codewhispererLanguage : this . _language ,
163
- codewhispererAcceptedTokens : acceptedTokens ,
133
+ codewhispererAcceptedTokens : unmodifiedAcceptedTokens ,
134
+ codewhispererSuggestedTokens : acceptedTokens ,
164
135
codewhispererPercentage : percentage ? percentage : 0 ,
165
136
successCount : this . _serviceInvocationCount ,
166
137
codewhispererUserGroup : CodeWhispererUserGroupSettings . getUserGroup ( ) . toString ( ) ,
167
138
codewhispererCustomizationArn : selectedCustomization . arn === '' ? undefined : selectedCustomization . arn ,
168
139
credentialStartUrl : AuthUtil . instance . startUrl ,
169
- codewhispererUserInputDetails : JSON . stringify ( this . _userInputDetails ) ,
170
140
} )
171
141
172
142
client
@@ -237,17 +207,6 @@ export class CodeWhispererCodeCoverageTracker {
237
207
this . _acceptedTokens = { }
238
208
this . _startTime = 0
239
209
this . _serviceInvocationCount = 0
240
- this . _userInputDetails = {
241
- lt1 : { count : 0 , total : 0 } ,
242
- lt50 : { count : 0 , total : 0 } ,
243
- lt100 : { count : 0 , total : 0 } ,
244
- lt200 : { count : 0 , total : 0 } ,
245
- lt300 : { count : 0 , total : 0 } ,
246
- lt400 : { count : 0 , total : 0 } ,
247
- lt500 : { count : 0 , total : 0 } ,
248
- lt1000 : { count : 0 , total : 0 } ,
249
- gt1000 : { count : 0 , total : 0 } ,
250
- }
251
210
}
252
211
253
212
private closeTimer ( ) {
@@ -329,14 +288,10 @@ export class CodeWhispererCodeCoverageTracker {
329
288
if ( this . isFromUserKeystroke ( e ) ) {
330
289
this . tryStartTimer ( )
331
290
this . addTotalTokens ( e . document . fileName , 1 )
332
- this . _userInputDetails . lt1 . count += 1
333
- this . _userInputDetails . lt1 . total += 1
334
291
} else if ( this . getCharacterCountFromComplexEvent ( e ) !== 0 ) {
335
292
this . tryStartTimer ( )
336
293
const characterIncrease = this . getCharacterCountFromComplexEvent ( e )
337
294
this . addTotalTokens ( e . document . fileName , characterIncrease )
338
- this . _userInputDetails . lt1 . count += 1
339
- this . _userInputDetails . lt1 . total += characterIncrease
340
295
}
341
296
// also include multi character input within 50 characters (not from CWSPR)
342
297
else if (
@@ -351,33 +306,6 @@ export class CodeWhispererCodeCoverageTracker {
351
306
if ( multiCharInputSize < 50 && e . contentChanges [ 0 ] . text . trim ( ) . length > 0 ) {
352
307
this . addTotalTokens ( e . document . fileName , multiCharInputSize )
353
308
}
354
-
355
- // report multiple user input patterns for adjusting the threshold
356
- if ( multiCharInputSize < 50 ) {
357
- this . _userInputDetails . lt50 . total += multiCharInputSize
358
- this . _userInputDetails . lt50 . count += 1
359
- } else if ( multiCharInputSize < 100 ) {
360
- this . _userInputDetails . lt100 . total += multiCharInputSize
361
- this . _userInputDetails . lt100 . count += 1
362
- } else if ( multiCharInputSize < 200 ) {
363
- this . _userInputDetails . lt200 . total += multiCharInputSize
364
- this . _userInputDetails . lt200 . count += 1
365
- } else if ( multiCharInputSize < 300 ) {
366
- this . _userInputDetails . lt300 . total += multiCharInputSize
367
- this . _userInputDetails . lt300 . count += 1
368
- } else if ( multiCharInputSize < 400 ) {
369
- this . _userInputDetails . lt400 . total += multiCharInputSize
370
- this . _userInputDetails . lt400 . count += 1
371
- } else if ( multiCharInputSize < 500 ) {
372
- this . _userInputDetails . lt500 . total += multiCharInputSize
373
- this . _userInputDetails . lt500 . count += 1
374
- } else if ( multiCharInputSize < 1000 ) {
375
- this . _userInputDetails . lt1000 . total += multiCharInputSize
376
- this . _userInputDetails . lt1000 . count += 1
377
- } else {
378
- this . _userInputDetails . gt1000 . total += multiCharInputSize
379
- this . _userInputDetails . gt1000 . count += 1
380
- }
381
309
}
382
310
}
383
311
0 commit comments