From 7dd0a03ffe1d0707bfd8b6dbcdcfa3dadd735d42 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 31 Jul 2025 14:19:31 -0700 Subject: [PATCH] Update callToolById.ts --- gui/src/redux/thunks/callToolById.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gui/src/redux/thunks/callToolById.ts b/gui/src/redux/thunks/callToolById.ts index 26640709b..1f94a8ab0 100644 --- a/gui/src/redux/thunks/callToolById.ts +++ b/gui/src/redux/thunks/callToolById.ts @@ -31,7 +31,8 @@ export const callToolById = createAsyncThunk< return; } - // Track tool call acceptance + // Track tool call acceptance and start timing + const startTime = Date.now(); posthog.capture("gui_tool_call_decision", { decision: "accept", toolName: toolCallState.toolCall.function.name, @@ -115,11 +116,13 @@ export const callToolById = createAsyncThunk< ); } - // Capture telemetry for tool call execution outcome + // Capture telemetry for tool call execution outcome with duration + const duration_ms = Date.now() - startTime; posthog.capture("gui_tool_call_outcome", { succeeded: errorMessage === undefined, toolName: toolCallState.toolCall.function.name, errorMessage: errorMessage, + duration_ms: duration_ms, }); if (streamResponse) {