mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-03 00:14:28 -07:00
Log Model Slash Commands (#9250)
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
EVENT_RIPGREP_FALLBACK,
|
||||
EVENT_MODEL_ROUTING,
|
||||
EVENT_EXTENSION_INSTALL,
|
||||
EVENT_MODEL_SLASH_COMMAND,
|
||||
EVENT_EXTENSION_DISABLE,
|
||||
} from './constants.js';
|
||||
import type {
|
||||
@@ -62,6 +63,7 @@ import type {
|
||||
ExtensionEnableEvent,
|
||||
ExtensionUninstallEvent,
|
||||
ExtensionInstallEvent,
|
||||
ModelSlashCommandEvent,
|
||||
} from './types.js';
|
||||
import {
|
||||
recordApiErrorMetrics,
|
||||
@@ -74,6 +76,7 @@ import {
|
||||
recordContentRetry,
|
||||
recordContentRetryFailure,
|
||||
recordModelRoutingMetrics,
|
||||
recordModelSlashCommand,
|
||||
} from './metrics.js';
|
||||
import { isTelemetrySdkInitialized } from './sdk.js';
|
||||
import type { UiEvent } from './uiTelemetry.js';
|
||||
@@ -700,6 +703,28 @@ export function logModelRouting(
|
||||
recordModelRoutingMetrics(config, event);
|
||||
}
|
||||
|
||||
export function logModelSlashCommand(
|
||||
config: Config,
|
||||
event: ModelSlashCommandEvent,
|
||||
): void {
|
||||
ClearcutLogger.getInstance(config)?.logModelSlashCommandEvent(event);
|
||||
if (!isTelemetrySdkInitialized()) return;
|
||||
|
||||
const attributes: LogAttributes = {
|
||||
...getCommonAttributes(config),
|
||||
...event,
|
||||
'event.name': EVENT_MODEL_SLASH_COMMAND,
|
||||
};
|
||||
|
||||
const logger = logs.getLogger(SERVICE_NAME);
|
||||
const logRecord: LogRecord = {
|
||||
body: `Model slash command. Model: ${event.model_name}`,
|
||||
attributes,
|
||||
};
|
||||
logger.emit(logRecord);
|
||||
recordModelSlashCommand(config, event);
|
||||
}
|
||||
|
||||
export function logExtensionInstallEvent(
|
||||
config: Config,
|
||||
event: ExtensionInstallEvent,
|
||||
|
||||
Reference in New Issue
Block a user