Skip to content

Commit f1d5038

Browse files
authored
Fix chat.modeChange telemetry to use agent names and add metadata (microsoft#277927)
Fix chat.modeChange telemetry to use agent names and add metadata (microsoft#277564)
1 parent 9c8157e commit f1d5038

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,23 @@ export interface IToggleChatModeArgs {
293293
type ChatModeChangeClassification = {
294294
owner: 'digitarald';
295295
comment: 'Reporting when agent is switched between different modes';
296-
fromMode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The previous agent' };
297-
toMode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The new agent' };
296+
fromMode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The previous agent name' };
297+
mode?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The new agent name' };
298298
requestCount?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of requests in the current chat session'; 'isMeasurement': true };
299+
storage?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Source of the target mode (builtin, local, user, extension)' };
300+
extensionId?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extension ID if the target mode is from an extension' };
301+
toolsCount?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of custom tools in the target mode'; 'isMeasurement': true };
302+
handoffsCount?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of handoffs in the target mode'; 'isMeasurement': true };
299303
};
300304

301305
type ChatModeChangeEvent = {
302306
fromMode: string;
303-
toMode: string;
307+
mode: string;
304308
requestCount: number;
309+
storage?: string;
310+
extensionId?: string;
311+
toolsCount?: number;
312+
handoffsCount?: number;
305313
};
306314

307315
class ToggleChatModeAction extends Action2 {
@@ -348,10 +356,19 @@ class ToggleChatModeAction extends Action2 {
348356
}
349357

350358
// Send telemetry for mode change
359+
const storage = switchToMode.source?.storage ?? 'builtin';
360+
const extensionId = switchToMode.source?.storage === 'extension' ? switchToMode.source.extensionId.value : undefined;
361+
const toolsCount = switchToMode.customTools?.get()?.length ?? 0;
362+
const handoffsCount = switchToMode.handOffs?.get()?.length ?? 0;
363+
351364
telemetryService.publicLog2<ChatModeChangeEvent, ChatModeChangeClassification>('chat.modeChange', {
352-
fromMode: currentMode.id,
353-
toMode: switchToMode.id,
354-
requestCount: requestCount
365+
fromMode: currentMode.name.get(),
366+
mode: switchToMode.name.get(),
367+
requestCount: requestCount,
368+
storage,
369+
extensionId,
370+
toolsCount,
371+
handoffsCount
355372
});
356373

357374
context.chatWidget.input.setChatMode(switchToMode.id);

0 commit comments

Comments
 (0)