fix(logging): Log NodeJS Version && Make Config.SessionID readonly (#7219)

This commit is contained in:
Richie Foreman
2025-08-28 14:22:39 -04:00
committed by GitHub
parent dd79e9b84a
commit a2faf34df8
4 changed files with 19 additions and 5 deletions

View File

@@ -212,7 +212,7 @@ export interface ConfigParameters {
export class Config {
private toolRegistry!: ToolRegistry;
private promptRegistry!: PromptRegistry;
private sessionId: string;
private readonly sessionId: string;
private fileSystemService: FileSystemService;
private contentGeneratorConfig!: ContentGeneratorConfig;
private readonly embeddingModel: string;
@@ -427,10 +427,6 @@ export class Config {
return this.sessionId;
}
setSessionId(sessionId: string): void {
this.sessionId = sessionId;
}
shouldLoadMemoryFromIncludeDirectories(): boolean {
return this.loadMemoryFromIncludeDirectories;
}

View File

@@ -262,6 +262,17 @@ describe('ClearcutLogger', () => {
);
});
it('logs the current nodejs version', () => {
const { logger } = setup({});
const event = logger?.createLogEvent(EventNames.API_ERROR, []);
expect(event?.event_metadata[0]).toContainEqual({
gemini_cli_key: EventMetadataKey.GEMINI_CLI_NODE_VERSION,
value: process.versions.node,
});
});
it('logs the current surface', () => {
const { logger } = setup({});

View File

@@ -889,6 +889,10 @@ export class ClearcutLogger {
gemini_cli_key: EventMetadataKey.GEMINI_CLI_OS,
value: process.platform,
},
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_NODE_VERSION,
value: process.versions.node,
},
];
return [...data, ...defaultLogMetadata];
}

View File

@@ -325,4 +325,7 @@ export enum EventMetadataKey {
// Logs the total duration in milliseconds for a content retry failure.
GEMINI_CLI_CONTENT_RETRY_FAILURE_TOTAL_DURATION_MS = 81,
// Logs the current nodejs version
GEMINI_CLI_NODE_VERSION = 83,
}