mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
metrics(extension) - Add logging for disable extension (#9238)
Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
EVENT_RIPGREP_FALLBACK,
|
||||
EVENT_MODEL_ROUTING,
|
||||
EVENT_EXTENSION_INSTALL,
|
||||
EVENT_EXTENSION_DISABLE,
|
||||
} from './constants.js';
|
||||
import type {
|
||||
ApiErrorEvent,
|
||||
@@ -57,6 +58,7 @@ import type {
|
||||
RipgrepFallbackEvent,
|
||||
ToolOutputTruncatedEvent,
|
||||
ModelRoutingEvent,
|
||||
ExtensionDisableEvent,
|
||||
ExtensionEnableEvent,
|
||||
ExtensionUninstallEvent,
|
||||
ExtensionInstallEvent,
|
||||
@@ -767,3 +769,25 @@ export function logExtensionEnable(
|
||||
};
|
||||
logger.emit(logRecord);
|
||||
}
|
||||
|
||||
export function logExtensionDisable(
|
||||
config: Config,
|
||||
event: ExtensionDisableEvent,
|
||||
): void {
|
||||
ClearcutLogger.getInstance(config)?.logExtensionDisableEvent(event);
|
||||
if (!isTelemetrySdkInitialized()) return;
|
||||
|
||||
const attributes: LogAttributes = {
|
||||
...getCommonAttributes(config),
|
||||
...event,
|
||||
'event.name': EVENT_EXTENSION_DISABLE,
|
||||
'event.timestamp': new Date().toISOString(),
|
||||
};
|
||||
|
||||
const logger = logs.getLogger(SERVICE_NAME);
|
||||
const logRecord: LogRecord = {
|
||||
body: `Disabled extension ${event.extension_name}`,
|
||||
attributes,
|
||||
};
|
||||
logger.emit(logRecord);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user