fix(core): add telemetry support for smart edit correction events (#10378)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
anthony bushong
2025-10-01 18:35:45 -07:00
committed by GitHub
parent 14dbda9145
commit aa8b2abe3d
6 changed files with 71 additions and 4 deletions
+9 -1
View File
@@ -34,6 +34,8 @@ import { applyReplacement } from './edit.js';
import { safeLiteralReplace } from '../utils/textUtils.js';
import { SmartEditStrategyEvent } from '../telemetry/types.js';
import { logSmartEditStrategy } from '../telemetry/loggers.js';
import { SmartEditCorrectionEvent } from '../telemetry/types.js';
import { logSmartEditCorrectionEvent } from '../telemetry/loggers.js';
interface ReplacementContext {
params: EditToolParams;
@@ -416,7 +418,10 @@ class EditToolInvocation implements ToolInvocation<EditToolParams, ToolResult> {
);
if (secondError) {
// The fix failed, return the original error
// The fix failed, log failure and return the original error
const event = new SmartEditCorrectionEvent('failure');
logSmartEditCorrectionEvent(this.config, event);
return {
currentContent,
newContent: currentContent,
@@ -427,6 +432,9 @@ class EditToolInvocation implements ToolInvocation<EditToolParams, ToolResult> {
};
}
const event = new SmartEditCorrectionEvent('success');
logSmartEditCorrectionEvent(this.config, event);
return {
currentContent,
newContent: secondAttemptResult.newContent,