Skip to content

Commit ed93e7d

Browse files
authored
detect invocations of chat participant for copilotCLI and copilotCloud (#1814)
1 parent 265e5ec commit ed93e7d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ChatExtendedRequestHandler, l10n, Uri } from 'vscode';
88
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
99
import { IVSCodeExtensionContext } from '../../../platform/extContext/common/extensionContext';
1010
import { IGitService } from '../../../platform/git/common/gitService';
11+
import { ITelemetryService } from '../../../platform/telemetry/common/telemetry';
1112
import { Emitter, Event } from '../../../util/vs/base/common/event';
1213
import { Disposable, DisposableStore, IDisposable } from '../../../util/vs/base/common/lifecycle';
1314
import { localize } from '../../../util/vs/nls';
@@ -297,6 +298,7 @@ export class CopilotCLIChatSessionParticipant {
297298
@IGitService private readonly gitService: IGitService,
298299
@ICopilotCLIModels private readonly copilotCLIModels: ICopilotCLIModels,
299300
@ICopilotCLISessionService private readonly sessionService: ICopilotCLISessionService,
301+
@ITelemetryService private readonly telemetryService: ITelemetryService,
300302
) { }
301303

302304
createHandler(): ChatExtendedRequestHandler {
@@ -305,6 +307,23 @@ export class CopilotCLIChatSessionParticipant {
305307

306308
private async handleRequest(request: vscode.ChatRequest, context: vscode.ChatContext, stream: vscode.ChatResponseStream, token: vscode.CancellationToken): Promise<vscode.ChatResult | void> {
307309
const { chatSessionContext } = context;
310+
311+
312+
/* __GDPR__
313+
"copilotcli.chat.invoke" : {
314+
"owner": "joshspicer",
315+
"comment": "Event sent when a CopilotCLI chat request is made.",
316+
"hasChatSessionItem": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Invoked with a chat session item." },
317+
"isUntitled": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Indicates if the chat session is untitled." },
318+
"hasDelegatePrompt": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Indicates if the prompt is a /delegate command." }
319+
}
320+
*/
321+
this.telemetryService.sendMSFTTelemetryEvent('copilotcli.chat.invoke', {
322+
hasChatSessionItem: String(!!chatSessionContext?.chatSessionItem),
323+
isUntitled: String(chatSessionContext?.isUntitled),
324+
hasDelegatePrompt: String(request.prompt.startsWith('/delegate'))
325+
});
326+
308327
if (!chatSessionContext) {
309328
if (request.acceptedConfirmationData || request.rejectedConfirmationData) {
310329
stream.warning(vscode.l10n.t('No chat session context available for confirmation data handling.'));

src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,19 @@ export class CopilotCloudSessionsProvider extends Disposable implements vscode.C
579579
return await this.handleConfirmationData(request, stream, token);
580580
}
581581

582+
/* __GDPR__
583+
"copilotcloud.chat.invoke" : {
584+
"owner": "joshspicer",
585+
"comment": "Event sent when a Copilot Cloud chat request is made.",
586+
"hasChatSessionItem": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Invoked with a chat session item." },
587+
"isUntitled": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Indicates if the chat session is untitled." }
588+
}
589+
*/
590+
this.telemetry.sendMSFTTelemetryEvent('copilotcloud.chat.invoke', {
591+
hasChatSessionItem: String(!!context.chatSessionContext?.chatSessionItem),
592+
isUntitled: String(context.chatSessionContext?.isUntitled)
593+
});
594+
582595
if (context.chatSessionContext?.isUntitled) {
583596
/* Generate new cloud agent session from an 'untitled' session */
584597

0 commit comments

Comments
 (0)