Fix for git issue 5657 to add lines of code added/removed telemetry (#5823)

Co-authored-by: Ravikant Agarwal <ravikantag@google.com>
This commit is contained in:
agarwalravikant
2025-08-08 10:08:07 +05:30
committed by GitHub
parent 86eaa03f8a
commit 5ab184fcaf
12 changed files with 408 additions and 14 deletions

View File

@@ -476,6 +476,24 @@ export class ClearcutLogger {
},
];
if (event.metadata) {
const metadataMapping: { [key: string]: EventMetadataKey } = {
ai_added_lines: EventMetadataKey.GEMINI_CLI_AI_ADDED_LINES,
ai_removed_lines: EventMetadataKey.GEMINI_CLI_AI_REMOVED_LINES,
user_added_lines: EventMetadataKey.GEMINI_CLI_USER_ADDED_LINES,
user_removed_lines: EventMetadataKey.GEMINI_CLI_USER_REMOVED_LINES,
};
for (const [key, gemini_cli_key] of Object.entries(metadataMapping)) {
if (event.metadata[key] !== undefined) {
data.push({
gemini_cli_key,
value: JSON.stringify(event.metadata[key]),
});
}
}
}
const logEvent = this.createLogEvent(tool_call_event_name, data);
this.enqueueLogEvent(logEvent);
this.flushIfNeeded();