feat(plan): create a metric for execution of plans generated in plan mode (#18236)

This commit is contained in:
Adib234
2026-02-05 18:46:34 -05:00
committed by GitHub
parent dd908a8d04
commit 3014614ffa
8 changed files with 173 additions and 2 deletions
+16
View File
@@ -55,6 +55,7 @@ import type {
HookCallEvent,
StartupStatsEvent,
LlmLoopCheckEvent,
PlanExecutionEvent,
} from './types.js';
import {
recordApiErrorMetrics,
@@ -73,6 +74,7 @@ import {
recordRecoveryAttemptMetrics,
recordLinesChanged,
recordHookCallMetrics,
recordPlanExecution,
} from './metrics.js';
import { bufferTelemetryEvent } from './sdk.js';
import type { UiEvent } from './uiTelemetry.js';
@@ -719,6 +721,20 @@ export function logApprovalModeDuration(
});
}
export function logPlanExecution(config: Config, event: PlanExecutionEvent) {
ClearcutLogger.getInstance(config)?.logPlanExecutionEvent(event);
bufferTelemetryEvent(() => {
logs.getLogger(SERVICE_NAME).emit({
body: event.toLogBody(),
attributes: event.toOpenTelemetryAttributes(config),
});
recordPlanExecution(config, {
approval_mode: event.approval_mode,
});
});
}
export function logHookCall(config: Config, event: HookCallEvent): void {
ClearcutLogger.getInstance(config)?.logHookCallEvent(event);
bufferTelemetryEvent(() => {