Log Model Slash Commands (#9250)

This commit is contained in:
Victor May
2025-09-23 18:06:03 -04:00
committed by GitHub
parent 28c3901513
commit 4bd4cd697b
8 changed files with 128 additions and 31 deletions
@@ -29,6 +29,7 @@ import type {
ExtensionUninstallEvent,
ModelRoutingEvent,
ExtensionEnableEvent,
ModelSlashCommandEvent,
ExtensionDisableEvent,
} from '../types.js';
import { EventMetadataKey } from './event-metadata-key.js';
@@ -69,6 +70,7 @@ export enum EventNames {
EXTENSION_UNINSTALL = 'extension_uninstall',
TOOL_OUTPUT_TRUNCATED = 'tool_output_truncated',
MODEL_ROUTING = 'model_routing',
MODEL_SLASH_COMMAND = 'model_slash_command',
}
export interface LogResponse {
@@ -994,6 +996,20 @@ export class ClearcutLogger {
this.flushIfNeeded();
}
logModelSlashCommandEvent(event: ModelSlashCommandEvent): void {
const data: EventValue[] = [
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_MODEL_SLASH_COMMAND,
value: event.model_name,
},
];
this.enqueueLogEvent(
this.createLogEvent(EventNames.MODEL_SLASH_COMMAND, data),
);
this.flushIfNeeded();
}
logExtensionDisableEvent(event: ExtensionDisableEvent): void {
const data: EventValue[] = [
{
@@ -401,4 +401,7 @@ export enum EventMetadataKey {
// Logs the source of the decision.
GEMINI_CLI_ROUTING_DECISION_SOURCE = 101,
// Logs an event when the user uses the /model command.
GEMINI_CLI_MODEL_SLASH_COMMAND = 103,
}