mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-02 07:54:48 -07:00
feat(logging): Add clearcut logging for disabling loop detection (#8503)
This commit is contained in:
@@ -49,6 +49,7 @@ export enum EventNames {
|
||||
FLASH_FALLBACK = 'flash_fallback',
|
||||
RIPGREP_FALLBACK = 'ripgrep_fallback',
|
||||
LOOP_DETECTED = 'loop_detected',
|
||||
LOOP_DETECTION_DISABLED = 'loop_detection_disabled',
|
||||
NEXT_SPEAKER_CHECK = 'next_speaker_check',
|
||||
SLASH_COMMAND = 'slash_command',
|
||||
MALFORMED_JSON_RESPONSE = 'malformed_json_response',
|
||||
@@ -657,6 +658,15 @@ export class ClearcutLogger {
|
||||
this.flushIfNeeded();
|
||||
}
|
||||
|
||||
logLoopDetectionDisabledEvent(): void {
|
||||
const data: EventValue[] = [];
|
||||
|
||||
this.enqueueLogEvent(
|
||||
this.createLogEvent(EventNames.LOOP_DETECTION_DISABLED, data),
|
||||
);
|
||||
this.flushIfNeeded();
|
||||
}
|
||||
|
||||
logNextSpeakerCheck(event: NextSpeakerCheckEvent): void {
|
||||
const data: EventValue[] = [
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ import type {
|
||||
FlashFallbackEvent,
|
||||
NextSpeakerCheckEvent,
|
||||
LoopDetectedEvent,
|
||||
LoopDetectionDisabledEvent,
|
||||
SlashCommandEvent,
|
||||
ConversationFinishedEvent,
|
||||
KittySequenceOverflowEvent,
|
||||
@@ -441,6 +442,13 @@ export function logLoopDetected(
|
||||
logger.emit(logRecord);
|
||||
}
|
||||
|
||||
export function logLoopDetectionDisabled(
|
||||
config: Config,
|
||||
_event: LoopDetectionDisabledEvent,
|
||||
): void {
|
||||
ClearcutLogger.getInstance(config)?.logLoopDetectionDisabledEvent();
|
||||
}
|
||||
|
||||
export function logNextSpeakerCheck(
|
||||
config: Config,
|
||||
event: NextSpeakerCheckEvent,
|
||||
|
||||
@@ -313,6 +313,18 @@ export class LoopDetectedEvent implements BaseTelemetryEvent {
|
||||
}
|
||||
}
|
||||
|
||||
export class LoopDetectionDisabledEvent implements BaseTelemetryEvent {
|
||||
'event.name': 'loop_detection_disabled';
|
||||
'event.timestamp': string;
|
||||
prompt_id: string;
|
||||
|
||||
constructor(prompt_id: string) {
|
||||
this['event.name'] = 'loop_detection_disabled';
|
||||
this['event.timestamp'] = new Date().toISOString();
|
||||
this.prompt_id = prompt_id;
|
||||
}
|
||||
}
|
||||
|
||||
export class NextSpeakerCheckEvent implements BaseTelemetryEvent {
|
||||
'event.name': 'next_speaker_check';
|
||||
'event.timestamp': string;
|
||||
@@ -524,6 +536,7 @@ export type TelemetryEvent =
|
||||
| ApiResponseEvent
|
||||
| FlashFallbackEvent
|
||||
| LoopDetectedEvent
|
||||
| LoopDetectionDisabledEvent
|
||||
| NextSpeakerCheckEvent
|
||||
| KittySequenceOverflowEvent
|
||||
| MalformedJsonResponseEvent
|
||||
|
||||
Reference in New Issue
Block a user