Revert "chore(cli/slashcommands): Add status enum to SlashCommandEvent telemetry" (#6161)

This commit is contained in:
Jacob Richman
2025-08-13 11:13:18 -07:00
committed by GitHub
parent 38876b738f
commit e4473a9007
7 changed files with 124 additions and 218 deletions

View File

@@ -15,4 +15,3 @@ export {
IdeConnectionEvent,
IdeConnectionType,
} from './src/telemetry/types.js';
export { makeFakeConfig } from './src/test-utils/config.js';

View File

@@ -639,13 +639,6 @@ export class ClearcutLogger {
});
}
if (event.status) {
data.push({
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SLASH_COMMAND_STATUS,
value: JSON.stringify(event.status),
});
}
this.enqueueLogEvent(this.createLogEvent(slash_command_event_name, data));
this.flushIfNeeded();
}

View File

@@ -174,9 +174,6 @@ export enum EventMetadataKey {
// Logs the subcommand of the slash command.
GEMINI_CLI_SLASH_COMMAND_SUBCOMMAND = 42,
// Logs the status of the slash command (e.g. 'success', 'error')
GEMINI_CLI_SLASH_COMMAND_STATUS = 51,
// ==========================================================================
// Next Speaker Check Event Keys
// ===========================================================================

View File

@@ -41,8 +41,6 @@ export {
FlashFallbackEvent,
SlashCommandEvent,
KittySequenceOverflowEvent,
makeSlashCommandEvent,
SlashCommandStatus,
} from './types.js';
export { SpanStatusCode, ValueType } from '@opentelemetry/api';
export { SemanticAttributes } from '@opentelemetry/semantic-conventions';

View File

@@ -14,17 +14,9 @@ import {
ToolCallDecision,
} from './tool-call-decision.js';
interface BaseTelemetryEvent {
'event.name': string;
/** Current timestamp in ISO 8601 format */
'event.timestamp': string;
}
type CommonFields = keyof BaseTelemetryEvent;
export class StartSessionEvent implements BaseTelemetryEvent {
export class StartSessionEvent {
'event.name': 'cli_config';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
model: string;
embedding_model: string;
sandbox_enabled: boolean;
@@ -68,9 +60,9 @@ export class StartSessionEvent implements BaseTelemetryEvent {
}
}
export class EndSessionEvent implements BaseTelemetryEvent {
export class EndSessionEvent {
'event.name': 'end_session';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
session_id?: string;
constructor(config?: Config) {
@@ -80,9 +72,9 @@ export class EndSessionEvent implements BaseTelemetryEvent {
}
}
export class UserPromptEvent implements BaseTelemetryEvent {
export class UserPromptEvent {
'event.name': 'user_prompt';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
prompt_length: number;
prompt_id: string;
auth_type?: string;
@@ -103,9 +95,9 @@ export class UserPromptEvent implements BaseTelemetryEvent {
}
}
export class ToolCallEvent implements BaseTelemetryEvent {
export class ToolCallEvent {
'event.name': 'tool_call';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
function_name: string;
function_args: Record<string, unknown>;
duration_ms: number;
@@ -150,9 +142,9 @@ export class ToolCallEvent implements BaseTelemetryEvent {
}
}
export class ApiRequestEvent implements BaseTelemetryEvent {
export class ApiRequestEvent {
'event.name': 'api_request';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
model: string;
prompt_id: string;
request_text?: string;
@@ -166,9 +158,9 @@ export class ApiRequestEvent implements BaseTelemetryEvent {
}
}
export class ApiErrorEvent implements BaseTelemetryEvent {
export class ApiErrorEvent {
'event.name': 'api_error';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
model: string;
error: string;
error_type?: string;
@@ -198,9 +190,9 @@ export class ApiErrorEvent implements BaseTelemetryEvent {
}
}
export class ApiResponseEvent implements BaseTelemetryEvent {
export class ApiResponseEvent {
'event.name': 'api_response';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
model: string;
status_code?: number | string;
duration_ms: number;
@@ -242,9 +234,9 @@ export class ApiResponseEvent implements BaseTelemetryEvent {
}
}
export class FlashFallbackEvent implements BaseTelemetryEvent {
export class FlashFallbackEvent {
'event.name': 'flash_fallback';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
auth_type: string;
constructor(auth_type: string) {
@@ -260,9 +252,9 @@ export enum LoopType {
LLM_DETECTED_LOOP = 'llm_detected_loop',
}
export class LoopDetectedEvent implements BaseTelemetryEvent {
export class LoopDetectedEvent {
'event.name': 'loop_detected';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
loop_type: LoopType;
prompt_id: string;
@@ -274,9 +266,9 @@ export class LoopDetectedEvent implements BaseTelemetryEvent {
}
}
export class NextSpeakerCheckEvent implements BaseTelemetryEvent {
export class NextSpeakerCheckEvent {
'event.name': 'next_speaker_check';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
prompt_id: string;
finish_reason: string;
result: string;
@@ -290,36 +282,23 @@ export class NextSpeakerCheckEvent implements BaseTelemetryEvent {
}
}
export interface SlashCommandEvent extends BaseTelemetryEvent {
export class SlashCommandEvent {
'event.name': 'slash_command';
'event.timestamp': string; // ISO 8106
command: string;
subcommand?: string;
status?: SlashCommandStatus;
constructor(command: string, subcommand?: string) {
this['event.name'] = 'slash_command';
this['event.timestamp'] = new Date().toISOString();
this.command = command;
this.subcommand = subcommand;
}
}
export function makeSlashCommandEvent({
command,
subcommand,
status,
}: Omit<SlashCommandEvent, CommonFields>): SlashCommandEvent {
return {
'event.name': 'slash_command',
'event.timestamp': new Date().toISOString(),
command,
subcommand,
status,
};
}
export enum SlashCommandStatus {
SUCCESS = 'success',
ERROR = 'error',
}
export class MalformedJsonResponseEvent implements BaseTelemetryEvent {
export class MalformedJsonResponseEvent {
'event.name': 'malformed_json_response';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
model: string;
constructor(model: string) {
@@ -336,7 +315,7 @@ export enum IdeConnectionType {
export class IdeConnectionEvent {
'event.name': 'ide_connection';
'event.timestamp': string;
'event.timestamp': string; // ISO 8601
connection_type: IdeConnectionType;
constructor(connection_type: IdeConnectionType) {