Skip to content

Add provider ID to terminal suggest telemetry #252016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IPromptInputModel } from '../../../../../platform/terminal/common/capab
import { ITerminalCompletion, TerminalCompletionItemKind } from './terminalCompletionItem.js';

export class TerminalSuggestTelemetry extends Disposable {
private _acceptedCompletions: Array<{ label: string; kind?: string; sessionId: string }> | undefined;
private _acceptedCompletions: Array<{ label: string; kind?: string; sessionId: string; provider: string }> | undefined;

private _kindMap = new Map<number, string>([
[TerminalCompletionItemKind.File, 'File'],
Expand Down Expand Up @@ -46,7 +46,7 @@ export class TerminalSuggestTelemetry extends Disposable {
return;
}
this._acceptedCompletions = this._acceptedCompletions || [];
this._acceptedCompletions.push({ label: typeof completion.label === 'string' ? completion.label : completion.label.label, kind: this._kindMap.get(completion.kind!), sessionId });
this._acceptedCompletions.push({ label: typeof completion.label === 'string' ? completion.label : completion.label.label, kind: this._kindMap.get(completion.kind!), sessionId, provider: completion.provider });
}

/**
Expand Down Expand Up @@ -98,8 +98,9 @@ export class TerminalSuggestTelemetry extends Disposable {
for (const completion of this._acceptedCompletions || []) {
const label = completion?.label;
const kind = completion?.kind;
const provider = completion?.provider;

if (label === undefined || commandLine === undefined || kind === undefined) {
if (label === undefined || commandLine === undefined || kind === undefined || provider === undefined) {
return;
}

Expand All @@ -118,6 +119,7 @@ export class TerminalSuggestTelemetry extends Disposable {
outcome: string;
exitCode: number | undefined;
sessionId: string;
provider: string | undefined;
}, {
owner: 'meganrogge';
comment: 'This data is collected to understand the outcome of a terminal completion acceptance.';
Expand All @@ -141,11 +143,17 @@ export class TerminalSuggestTelemetry extends Disposable {
purpose: 'FeatureInsight';
comment: 'The session ID of the terminal session where the completion was accepted';
};
provider: {
classification: 'SystemMetaData';
purpose: 'FeatureInsight';
comment: 'The ID of the provider that supplied the completion';
};
}>('terminal.suggest.acceptedCompletion', {
kind,
outcome,
exitCode,
sessionId: completion.sessionId
sessionId: completion.sessionId,
provider
});
}
}
Expand Down
Loading