metrics(extension) - Add logging for disable extension (#9238)

Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
shishu314
2025-09-23 14:37:35 -04:00
committed by GitHub
parent 31c609daec
commit 98461ff667
9 changed files with 123 additions and 0 deletions
+24
View File
@@ -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);
}