Capturing telemetry events for write to file failures (#2527)
* added telemetry to track diff edit failures * changeset
This commit is contained in:
1 parent
931279c845
commit
aec21bb299
3 files changed
+32
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": minor
|
||||
---
|
||||
|
||||
added telemetry to track replace_in_file tool failures
|
||||
@@ -1748,6 +1748,16 @@ export class Cline {
|
||||
)
|
||||
} catch (error) {
|
||||
await this.say("diff_error", relPath)
|
||||
|
||||
// Extract error type from error message if possible, or use a generic type
|
||||
const errorType =
|
||||
error instanceof Error && error.message.includes("does not match anything")
|
||||
? "search_not_found"
|
||||
: "other_diff_error"
|
||||
|
||||
// Add telemetry for diff edit failure
|
||||
telemetryService.captureDiffEditFailure(this.taskId, errorType)
|
||||
|
||||
pushToolResult(
|
||||
formatResponse.toolError(
|
||||
`${(error as Error)?.message}\n\n` +
|
||||
|
||||
@@ -32,6 +32,8 @@ class PostHogClient {
|
||||
HISTORICAL_LOADED: "task.historical_loaded",
|
||||
// Tracks when the retry button is clicked for failed operations
|
||||
RETRY_CLICKED: "task.retry_clicked",
|
||||
// Tracks when a diff edit (replace_in_file) operation fails
|
||||
DIFF_EDIT_FAILED: "task.diff_edit_failed",
|
||||
},
|
||||
// UI interaction events for tracking user engagement
|
||||
UI: {
|
||||
@@ -377,6 +379,21 @@ class PostHogClient {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Records when a diff edit (replace_in_file) operation fails
|
||||
* @param taskId Unique identifier for the task
|
||||
* @param errorType Type of error that occurred (e.g., "search_not_found", "invalid_format")
|
||||
*/
|
||||
public captureDiffEditFailure(taskId: string, errorType?: string) {
|
||||
this.capture({
|
||||
event: PostHogClient.EVENTS.TASK.DIFF_EDIT_FAILED,
|
||||
properties: {
|
||||
taskId,
|
||||
errorType,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Records when a different model is selected for use
|
||||
* @param model Name of the selected model
|
||||
|
||||
Reference in new issue
Block a user