@@ -334,6 +334,10 @@ export class SuggestController implements IEditorContribution {
334
334
335
335
const isResolved = item . isResolved ;
336
336
337
+ // telemetry data points: duration of command execution, info about async additional edits (-1=n/a, -2=none, 1=success, 0=failed)
338
+ let _commandExectionDuration = - 1 ;
339
+ let _additionalEditsAppliedAsync = - 1 ;
340
+
337
341
if ( Array . isArray ( item . completion . additionalTextEdits ) ) {
338
342
339
343
// cancel -> stops all listening and closes widget
@@ -399,21 +403,7 @@ export class SuggestController implements IEditorContribution {
399
403
return true ;
400
404
} ) . then ( applied => {
401
405
this . _logService . trace ( '[suggest] async resolving of edits DONE (ms, applied?)' , sw . elapsed ( ) , applied ) ;
402
- type AsyncSuggestEdits = { extensionId : string ; providerId : string ; applied : boolean } ;
403
- type AsyncSuggestEditsClassification = {
404
- owner : 'jrieken' ;
405
- comment : 'Information about async additional text edits' ;
406
- extensionId : { classification : 'PublicNonPersonalData' ; purpose : 'FeatureInsight' ; comment : 'Extension contributing the completions item' } ;
407
- providerId : { classification : 'PublicNonPersonalData' ; purpose : 'FeatureInsight' ; comment : 'Provider of the completions item' } ;
408
- applied : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'If async additional text edits could be applied' } ;
409
- } ;
410
- if ( typeof applied === 'boolean' ) {
411
- this . _telemetryService . publicLog2 < AsyncSuggestEdits , AsyncSuggestEditsClassification > ( 'suggest.asyncAdditionalEdits' , {
412
- extensionId : item . extensionId ?. value ?? 'unknown' ,
413
- providerId : item . provider . _debugDisplayName ?? 'unknown' ,
414
- applied
415
- } ) ;
416
- }
406
+ _additionalEditsAppliedAsync = applied === true ? 1 : applied === false ? 0 : - 2 ;
417
407
} ) . finally ( ( ) => {
418
408
docListener . dispose ( ) ;
419
409
typeListener . dispose ( ) ;
@@ -448,12 +438,15 @@ export class SuggestController implements IEditorContribution {
448
438
this . model . trigger ( { auto : true , retrigger : true } ) ;
449
439
} else {
450
440
// exec command, done
441
+ const sw = new StopWatch ( ) ;
451
442
tasks . push ( this . _commandService . executeCommand ( item . completion . command . id , ...( item . completion . command . arguments ? [ ...item . completion . command . arguments ] : [ ] ) ) . catch ( e => {
452
443
if ( item . completion . extensionId ) {
453
444
onUnexpectedExternalError ( e ) ;
454
445
} else {
455
446
onUnexpectedError ( e ) ;
456
447
}
448
+ } ) . finally ( ( ) => {
449
+ _commandExectionDuration = sw . elapsed ( ) ;
457
450
} ) ) ;
458
451
}
459
452
}
@@ -484,14 +477,14 @@ export class SuggestController implements IEditorContribution {
484
477
485
478
// clear only now - after all tasks are done
486
479
Promise . all ( tasks ) . finally ( ( ) => {
487
- this . _reportSuggestionAcceptedTelemetry ( item , model , isResolved ) ;
480
+ this . _reportSuggestionAcceptedTelemetry ( item , model , isResolved , _commandExectionDuration , _additionalEditsAppliedAsync ) ;
488
481
489
482
this . model . clear ( ) ;
490
483
cts . dispose ( ) ;
491
484
} ) ;
492
485
}
493
486
494
- private _reportSuggestionAcceptedTelemetry ( item : CompletionItem , model : ITextModel , itemResolved : boolean ) {
487
+ private _reportSuggestionAcceptedTelemetry ( item : CompletionItem , model : ITextModel , itemResolved : boolean , commandExectionDuration : number , additionalEditsAppliedAsync : number ) {
495
488
496
489
if ( Math . floor ( Math . random ( ) * 100 ) === 0 ) {
497
490
// throttle telemetry event because accepting completions happens a lot
@@ -502,6 +495,8 @@ export class SuggestController implements IEditorContribution {
502
495
extensionId : string ; providerId : string ;
503
496
fileExtension : string ; languageId : string ; basenameHash : string ; kind : number ;
504
497
resolveInfo : number ; resolveDuration : number ;
498
+ commandDuration : number ;
499
+ additionalEditsAsync : number ;
505
500
} ;
506
501
type AcceptedSuggestionClassification = {
507
502
owner : 'jrieken' ;
@@ -514,6 +509,8 @@ export class SuggestController implements IEditorContribution {
514
509
kind : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'The completion item kind' } ;
515
510
resolveInfo : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'If the item was inserted before resolving was done' } ;
516
511
resolveDuration : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'How long resolving took to finish' } ;
512
+ commandDuration : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'How long a completion item command took' } ;
513
+ additionalEditsAsync : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; isMeasurement : true ; comment : 'Info about asynchronously applying additional edits' } ;
517
514
} ;
518
515
519
516
this . _telemetryService . publicLog2 < AcceptedSuggestion , AcceptedSuggestionClassification > ( 'suggest.acceptedSuggestion' , {
@@ -524,7 +521,9 @@ export class SuggestController implements IEditorContribution {
524
521
languageId : model . getLanguageId ( ) ,
525
522
fileExtension : extname ( model . uri ) ,
526
523
resolveInfo : ! item . provider . resolveCompletionItem ? - 1 : itemResolved ? 1 : 0 ,
527
- resolveDuration : item . resolveDuration
524
+ resolveDuration : item . resolveDuration ,
525
+ commandDuration : commandExectionDuration ,
526
+ additionalEditsAsync : additionalEditsAppliedAsync
528
527
} ) ;
529
528
}
530
529
0 commit comments