mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
feat: add file change tracking to session metrics (#6094)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -63,6 +63,10 @@ export interface SessionMetrics {
|
||||
};
|
||||
byName: Record<string, ToolCallStats>;
|
||||
};
|
||||
files: {
|
||||
totalLinesAdded: number;
|
||||
totalLinesRemoved: number;
|
||||
};
|
||||
}
|
||||
|
||||
const createInitialModelMetrics = (): ModelMetrics => ({
|
||||
@@ -96,6 +100,10 @@ const createInitialMetrics = (): SessionMetrics => ({
|
||||
},
|
||||
byName: {},
|
||||
},
|
||||
files: {
|
||||
totalLinesAdded: 0,
|
||||
totalLinesRemoved: 0,
|
||||
},
|
||||
});
|
||||
|
||||
export class UiTelemetryService extends EventEmitter {
|
||||
@@ -171,7 +179,7 @@ export class UiTelemetryService extends EventEmitter {
|
||||
}
|
||||
|
||||
private processToolCall(event: ToolCallEvent) {
|
||||
const { tools } = this.#metrics;
|
||||
const { tools, files } = this.#metrics;
|
||||
tools.totalCalls++;
|
||||
tools.totalDurationMs += event.duration_ms;
|
||||
|
||||
@@ -209,6 +217,16 @@ export class UiTelemetryService extends EventEmitter {
|
||||
tools.totalDecisions[event.decision]++;
|
||||
toolStats.decisions[event.decision]++;
|
||||
}
|
||||
|
||||
// Aggregate line count data from metadata
|
||||
if (event.metadata) {
|
||||
if (event.metadata['ai_added_lines'] !== undefined) {
|
||||
files.totalLinesAdded += event.metadata['ai_added_lines'];
|
||||
}
|
||||
if (event.metadata['ai_removed_lines'] !== undefined) {
|
||||
files.totalLinesRemoved += event.metadata['ai_removed_lines'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user