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
@@ -45,6 +45,7 @@ import type {
HookCallEvent,
ApprovalModeSwitchEvent,
ApprovalModeDurationEvent,
PlanExecutionEvent,
} from '../types.js';
import { EventMetadataKey } from './event-metadata-key.js';
import type { Config } from '../../config/config.js';
@@ -106,6 +107,7 @@ export enum EventNames {
HOOK_CALL = 'hook_call',
APPROVAL_MODE_SWITCH = 'approval_mode_switch',
APPROVAL_MODE_DURATION = 'approval_mode_duration',
PLAN_EXECUTION = 'plan_execution',
}
export interface LogResponse {
@@ -1543,6 +1545,18 @@ export class ClearcutLogger {
this.flushIfNeeded();
}
logPlanExecutionEvent(event: PlanExecutionEvent): void {
const data: EventValue[] = [
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_APPROVAL_MODE,
value: event.approval_mode,
},
];
this.enqueueLogEvent(this.createLogEvent(EventNames.PLAN_EXECUTION, data));
this.flushIfNeeded();
}
/**
* Adds default fields to data, and returns a new data array. This fields
* should exist on all log events.