Telemetry to determine if NES completion for active doc (#779)

This commit is contained in:
Don Jayamanne
2025-08-27 01:58:47 +00:00
committed by GitHub
parent 696e842436
commit dbe2be271a
2 changed files with 14 additions and 1 deletions
@@ -112,6 +112,7 @@ export interface INextEditProviderTelemetry extends ILlmNESTelemetry, IDiagnosti
readonly alternativeAction: IAlternativeAction | undefined;
readonly postProcessingOutcome: string | undefined;
readonly isNESForAnotherDoc: boolean;
readonly isActiveDocument?: boolean;
readonly isNaturalLanguageDominated: boolean;
readonly hadLlmNES: boolean;
@@ -448,6 +449,7 @@ export class NextEditProviderTelemetryBuilder extends Disposable {
supersededByOpportunityId: this._supersededByOpportunityId,
pickedNES: this._nesTypePicked,
hadLlmNES: this._hadLlmNES,
isActiveDocument: this._isActiveDocument,
isNESForAnotherDoc: this._isNESForAnotherDoc,
hadDiagnosticsNES: this._hadDiagnosticsNES,
configIsDiagnosticsNESEnabled: this._configIsDiagnosticsNESEnabled,
@@ -519,6 +521,12 @@ export class NextEditProviderTelemetryBuilder extends Disposable {
return this;
}
private _isActiveDocument?: boolean;
public setIsActiveDocument(isActive: boolean): this {
this._isActiveDocument = isActive;
return this;
}
private _isNESForAnotherDoc: boolean = false;
public setIsNESForOtherEditor(): this {
this._isNESForAnotherDoc = true;
@@ -649,6 +657,7 @@ export class TelemetrySender implements IDisposable {
isNotebook,
notebookType,
isNESForAnotherDoc,
isActiveDocument,
acceptance,
disposalReason,
logProbThreshold,
@@ -732,6 +741,7 @@ export class TelemetrySender implements IDisposable {
"isShown": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the edit was shown", "isMeasurement": true },
"isNotebook": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the document is a notebook", "isMeasurement": true },
"isNESForAnotherDoc": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the NES if for another document", "isMeasurement": true },
"isActiveDocument": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the document is the active document", "isMeasurement": true },
"hasNotebookCellMarker": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the edit has a notebook cell marker", "isMeasurement": true },
"notebookType": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Type of notebook, if any" },
"logProbThreshold": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Log probability threshold for the edit", "isMeasurement": true },
@@ -799,6 +809,7 @@ export class TelemetrySender implements IDisposable {
isShown: this._boolToNum(isShown),
isNotebook: this._boolToNum(isNotebook),
isNESForAnotherDoc: this._boolToNum(isNESForAnotherDoc),
isActiveDocument: this._boolToNum(isActiveDocument),
hasNotebookCellMarker: this._boolToNum(hasNotebookCellMarker),
logProbThreshold,
documentsCount,
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken, Command, InlineCompletionContext, InlineCompletionDisplayLocation, InlineCompletionDisplayLocationKind, InlineCompletionEndOfLifeReason, InlineCompletionEndOfLifeReasonKind, InlineCompletionItem, InlineCompletionItemProvider, InlineCompletionList, InlineCompletionsDisposeReason, InlineCompletionsDisposeReasonKind, Position, Range, TextDocument, TextDocumentShowOptions, l10n, Event as vscodeEvent, workspace } from 'vscode';
import { CancellationToken, Command, InlineCompletionContext, InlineCompletionDisplayLocation, InlineCompletionDisplayLocationKind, InlineCompletionEndOfLifeReason, InlineCompletionEndOfLifeReasonKind, InlineCompletionItem, InlineCompletionItemProvider, InlineCompletionList, InlineCompletionsDisposeReason, InlineCompletionsDisposeReasonKind, Position, Range, TextDocument, TextDocumentShowOptions, l10n, Event as vscodeEvent, window, workspace } from 'vscode';
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
import { IDiffService } from '../../../platform/diff/common/diffService';
import { stringEditFromDiff } from '../../../platform/editing/common/edit';
@@ -236,6 +236,7 @@ export class InlineCompletionProviderImpl implements InlineCompletionItemProvide
tracer.trace('no next edit suggestion');
} else if (documents[0][0] === document) {
// nes is for this same document.
telemetryBuilder.setIsActiveDocument(window.activeTextEditor?.document === documents[0][0]);
range = documents[0][1];
const allowInlineCompletions = this.model.inlineEditsInlineCompletionsEnabled.get();
isInlineCompletion = allowInlineCompletions && isInlineSuggestion(position, document, range, result.edit.newText);
@@ -245,6 +246,7 @@ export class InlineCompletionProviderImpl implements InlineCompletionItemProvide
} else {
// nes is for a different document.
telemetryBuilder.setIsNESForOtherEditor();
telemetryBuilder.setIsActiveDocument(window.activeTextEditor?.document === documents[0][0]);
range = documents[0][1];
completionItem = serveAsCompletionsProvider ?
undefined :