File tree Expand file tree Collapse file tree
packages/opencode/src/telemetry Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 */
77
88import { Log } from "../util/log"
9- import { Bus } from "../bus"
109import { Config } from "../config/config"
1110import { createSanitizer , hashFilePath , getFileExtension } from "./sanitizer"
1211import { createSignalTracker , type SignalTracker } from "./signals"
Original file line number Diff line number Diff line change @@ -152,17 +152,18 @@ function subscribeToEvents(state: TelemetryState): void {
152152 Bus . subscribe ( MessageV2 . Event . PartUpdated , ( event ) => {
153153 const { part } = event . properties
154154
155- // Handle tool calls
156- if ( part . type === "tool" && part . state === "completed" ) {
155+ // Handle completed tool calls
156+ if ( part . type === "tool" && ( part . state === "completed" || part . state === "error" ) ) {
157157 const duration = part . time ?. end && part . time ?. start ? part . time . end - part . time . start : 0
158+ const status = part . state === "completed" ? "success" : "error"
158159
159160 collector . recordToolCall (
160161 part . tool ,
161- part . state === "completed" ? "success" : "error" ,
162+ status ,
162163 duration ,
163164 part . input ? JSON . stringify ( part . input ) . length : undefined ,
164165 part . output ? part . output . length : undefined ,
165- undefined , // errorType - would need to parse from output
166+ status === "error" ? "tool_error" : undefined ,
166167 )
167168 }
168169
You can’t perform that action at this time.
0 commit comments