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
+1 -5
View File
@@ -212,7 +212,7 @@ export interface ConfigParameters {
export class Config { export class Config {
private toolRegistry!: ToolRegistry; private toolRegistry!: ToolRegistry;
private promptRegistry!: PromptRegistry; private promptRegistry!: PromptRegistry;
private sessionId: string; private readonly sessionId: string;
private fileSystemService: FileSystemService; private fileSystemService: FileSystemService;
private contentGeneratorConfig!: ContentGeneratorConfig; private contentGeneratorConfig!: ContentGeneratorConfig;
private readonly embeddingModel: string; private readonly embeddingModel: string;
@@ -427,10 +427,6 @@ export class Config {
return this.sessionId; return this.sessionId;
} }
setSessionId(sessionId: string): void {
this.sessionId = sessionId;
}
shouldLoadMemoryFromIncludeDirectories(): boolean { shouldLoadMemoryFromIncludeDirectories(): boolean {
return this.loadMemoryFromIncludeDirectories; return this.loadMemoryFromIncludeDirectories;
} }
@@ -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', () => { it('logs the current surface', () => {
const { logger } = setup({}); const { logger } = setup({});
@@ -889,6 +889,10 @@ export class ClearcutLogger {
gemini_cli_key: EventMetadataKey.GEMINI_CLI_OS, gemini_cli_key: EventMetadataKey.GEMINI_CLI_OS,
value: process.platform, value: process.platform,
}, },
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_NODE_VERSION,
value: process.versions.node,
},
]; ];
return [...data, ...defaultLogMetadata]; return [...data, ...defaultLogMetadata];
} }
@@ -325,4 +325,7 @@ export enum EventMetadataKey {
// Logs the total duration in milliseconds for a content retry failure. // Logs the total duration in milliseconds for a content retry failure.
GEMINI_CLI_CONTENT_RETRY_FAILURE_TOTAL_DURATION_MS = 81, GEMINI_CLI_CONTENT_RETRY_FAILURE_TOTAL_DURATION_MS = 81,
// Logs the current nodejs version
GEMINI_CLI_NODE_VERSION = 83,
} }