Skip to content

Commit 95aefe8

Browse files
authored
add telemetry logging for todo list tool operations (microsoft#261087)
1 parent 221f3b4 commit 95aefe8

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/vs/workbench/contrib/chat/common/tools/manageTodoListTool.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
IPreparedToolInvocation
1919
} from '../languageModelToolsService.js';
2020
import { ILogService } from '../../../../../platform/log/common/log.js';
21+
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
2122
import { IChatTodo, IChatTodoListService, IChatTodoListStorage } from '../chatTodoListService.js';
2223
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
2324

@@ -90,7 +91,8 @@ export class ManageTodoListTool extends Disposable implements IToolImpl {
9091

9192
constructor(
9293
@IChatTodoListService private readonly chatTodoListService: IChatTodoListService,
93-
@ILogService private readonly logService: ILogService
94+
@ILogService private readonly logService: ILogService,
95+
@ITelemetryService private readonly telemetryService: ITelemetryService
9496
) {
9597
super();
9698
}
@@ -110,6 +112,17 @@ export class ManageTodoListTool extends Disposable implements IToolImpl {
110112
switch (args.operation) {
111113
case 'read': {
112114
const readResult = this.handleRead(storage, chatSessionId);
115+
const currentTodos = storage.getTodoList(chatSessionId);
116+
117+
this.telemetryService.publicLog2<TodoListToolInvokedEvent, TodoListToolInvokedClassification>(
118+
'todoListToolInvoked',
119+
{
120+
operation: 'read',
121+
todoItemCount: currentTodos.length,
122+
chatSessionId: chatSessionId
123+
}
124+
);
125+
113126
return {
114127
content: [{
115128
kind: 'text',
@@ -125,6 +138,16 @@ export class ManageTodoListTool extends Disposable implements IToolImpl {
125138
status: parsedTodo.status
126139
}));
127140
storage.setTodoList(chatSessionId, todoList);
141+
142+
this.telemetryService.publicLog2<TodoListToolInvokedEvent, TodoListToolInvokedClassification>(
143+
'todoListToolInvoked',
144+
{
145+
operation: 'write',
146+
todoItemCount: todoList.length,
147+
chatSessionId: chatSessionId
148+
}
149+
);
150+
128151
return {
129152
content: [{
130153
kind: 'text',
@@ -285,3 +308,17 @@ export class ManageTodoListTool extends Disposable implements IToolImpl {
285308
}).join('\n');
286309
}
287310
}
311+
312+
type TodoListToolInvokedEvent = {
313+
operation: 'read' | 'write';
314+
todoItemCount: number;
315+
chatSessionId: string | undefined;
316+
};
317+
318+
type TodoListToolInvokedClassification = {
319+
operation: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The operation performed on the todo list (read or write).' };
320+
todoItemCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of items in the todo list operation.' };
321+
chatSessionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The ID of the chat session that the tool was used within, if applicable.' };
322+
owner: 'bhavyaus';
323+
comment: 'Provides insight into the usage of the todo list tool.';
324+
};

0 commit comments

Comments
 (0)