Log flash continue (#4700)
This commit is contained in:
parent
67008d4643
commit
7c3a84075d
|
@ -43,7 +43,7 @@ import { ProxyAgent, setGlobalDispatcher } from 'undici';
|
||||||
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
||||||
import { LoopDetectionService } from '../services/loopDetectionService.js';
|
import { LoopDetectionService } from '../services/loopDetectionService.js';
|
||||||
import { ideContext } from '../services/ideContext.js';
|
import { ideContext } from '../services/ideContext.js';
|
||||||
import { ClearcutLogger } from '../telemetry/clearcut-logger/clearcut-logger.js';
|
import { logFlashDecidedToContinue } from '../telemetry/loggers.js';
|
||||||
import { FlashDecidedToContinueEvent } from '../telemetry/types.js';
|
import { FlashDecidedToContinueEvent } from '../telemetry/types.js';
|
||||||
|
|
||||||
function isThinkingSupported(model: string) {
|
function isThinkingSupported(model: string) {
|
||||||
|
@ -388,7 +388,8 @@ export class GeminiClient {
|
||||||
signal,
|
signal,
|
||||||
);
|
);
|
||||||
if (nextSpeakerCheck?.next_speaker === 'model') {
|
if (nextSpeakerCheck?.next_speaker === 'model') {
|
||||||
ClearcutLogger.getInstance(this.config)?.logFlashDecidedToContinueEvent(
|
logFlashDecidedToContinue(
|
||||||
|
this.config,
|
||||||
new FlashDecidedToContinueEvent(prompt_id),
|
new FlashDecidedToContinueEvent(prompt_id),
|
||||||
);
|
);
|
||||||
const nextRequest = [{ text: 'Please continue.' }];
|
const nextRequest = [{ text: 'Please continue.' }];
|
||||||
|
|
|
@ -13,6 +13,8 @@ export const EVENT_API_ERROR = 'gemini_cli.api_error';
|
||||||
export const EVENT_API_RESPONSE = 'gemini_cli.api_response';
|
export const EVENT_API_RESPONSE = 'gemini_cli.api_response';
|
||||||
export const EVENT_CLI_CONFIG = 'gemini_cli.config';
|
export const EVENT_CLI_CONFIG = 'gemini_cli.config';
|
||||||
export const EVENT_FLASH_FALLBACK = 'gemini_cli.flash_fallback';
|
export const EVENT_FLASH_FALLBACK = 'gemini_cli.flash_fallback';
|
||||||
|
export const EVENT_FLASH_DECIDED_TO_CONTINUE =
|
||||||
|
'gemini_cli.flash_decided_to_continue';
|
||||||
|
|
||||||
export const METRIC_TOOL_CALL_COUNT = 'gemini_cli.tool.call.count';
|
export const METRIC_TOOL_CALL_COUNT = 'gemini_cli.tool.call.count';
|
||||||
export const METRIC_TOOL_CALL_LATENCY = 'gemini_cli.tool.call.latency';
|
export const METRIC_TOOL_CALL_LATENCY = 'gemini_cli.tool.call.latency';
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
EVENT_TOOL_CALL,
|
EVENT_TOOL_CALL,
|
||||||
EVENT_USER_PROMPT,
|
EVENT_USER_PROMPT,
|
||||||
EVENT_FLASH_FALLBACK,
|
EVENT_FLASH_FALLBACK,
|
||||||
|
EVENT_FLASH_DECIDED_TO_CONTINUE,
|
||||||
SERVICE_NAME,
|
SERVICE_NAME,
|
||||||
} from './constants.js';
|
} from './constants.js';
|
||||||
import {
|
import {
|
||||||
|
@ -25,6 +26,7 @@ import {
|
||||||
ToolCallEvent,
|
ToolCallEvent,
|
||||||
UserPromptEvent,
|
UserPromptEvent,
|
||||||
FlashFallbackEvent,
|
FlashFallbackEvent,
|
||||||
|
FlashDecidedToContinueEvent,
|
||||||
LoopDetectedEvent,
|
LoopDetectedEvent,
|
||||||
} from './types.js';
|
} from './types.js';
|
||||||
import {
|
import {
|
||||||
|
@ -309,3 +311,24 @@ export function logLoopDetected(
|
||||||
};
|
};
|
||||||
logger.emit(logRecord);
|
logger.emit(logRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logFlashDecidedToContinue(
|
||||||
|
config: Config,
|
||||||
|
event: FlashDecidedToContinueEvent,
|
||||||
|
): void {
|
||||||
|
ClearcutLogger.getInstance(config)?.logFlashDecidedToContinueEvent(event);
|
||||||
|
if (!isTelemetrySdkInitialized()) return;
|
||||||
|
|
||||||
|
const attributes: LogAttributes = {
|
||||||
|
...getCommonAttributes(config),
|
||||||
|
...event,
|
||||||
|
'event.name': EVENT_FLASH_DECIDED_TO_CONTINUE,
|
||||||
|
};
|
||||||
|
|
||||||
|
const logger = logs.getLogger(SERVICE_NAME);
|
||||||
|
const logRecord: LogRecord = {
|
||||||
|
body: `Flash decided to continue.`,
|
||||||
|
attributes,
|
||||||
|
};
|
||||||
|
logger.emit(logRecord);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue