Skip to content

Commit 4f5796c

Browse files
authored
Add telemetry for diff errors (#2619)
1 parent 111ac9c commit 4f5796c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/core/tools/applyDiffTool.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { addLineNumbers } from "../../integrations/misc/extract-text"
1010
import path from "path"
1111
import fs from "fs/promises"
1212
import { RecordSource } from "../context-tracking/FileContextTrackerTypes"
13+
import { telemetryService } from "../../services/telemetry/TelemetryService"
1314

1415
export async function applyDiffTool(
1516
cline: Cline,
@@ -88,6 +89,9 @@ export async function applyDiffTool(
8889
const currentCount = (cline.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1
8990
cline.consecutiveMistakeCountForApplyDiff.set(relPath, currentCount)
9091
let formattedError = ""
92+
93+
telemetryService.captureDiffApplicationError(cline.taskId)
94+
9195
if (diffResult.failParts && diffResult.failParts.length > 0) {
9296
for (const failPart of diffResult.failParts) {
9397
if (failPart.success) {

src/services/telemetry/TelemetryService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class PostHogClient {
3030
},
3131
ERRORS: {
3232
SCHEMA_VALIDATION_ERROR: "Schema Validation Error",
33+
DIFF_APPLICATION_ERROR: "Diff Application Error",
3334
},
3435
}
3536

@@ -274,6 +275,12 @@ class TelemetryService {
274275
})
275276
}
276277

278+
public captureDiffApplicationError(taskId: string): void {
279+
this.captureEvent(PostHogClient.EVENTS.ERRORS.DIFF_APPLICATION_ERROR, {
280+
taskId,
281+
})
282+
}
283+
277284
/**
278285
* Checks if telemetry is currently enabled
279286
* @returns Whether telemetry is enabled

0 commit comments

Comments
 (0)