fix(metrics): Do not convert numerical metrics to strings (#6701)

Co-authored-by: Shnatu <snatu@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
Co-authored-by: Arya Gummadi <aryagummadi@google.com>
This commit is contained in:
Shardul Natu 2025-08-21 00:25:42 -07:00 committed by GitHub
parent f8f79bf2f7
commit 0242ecd83a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -385,12 +385,14 @@ export class ClearcutLogger {
{
gemini_cli_key:
EventMetadataKey.GEMINI_CLI_START_SESSION_MCP_SERVERS_COUNT,
value: event.mcp_servers_count ? event.mcp_servers_count : '',
value: event.mcp_servers_count
? event.mcp_servers_count.toString()
: '',
},
{
gemini_cli_key:
EventMetadataKey.GEMINI_CLI_START_SESSION_MCP_TOOLS_COUNT,
value: event.mcp_tools_count ? event.mcp_tools_count : '',
value: event.mcp_tools_count?.toString() ?? '',
},
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_MCP_TOOLS,

View File

@ -162,7 +162,7 @@ describe('loggers', () => {
file_filtering_respect_git_ignore: true,
debug_mode: true,
mcp_servers: 'test-server',
mcp_servers_count: '1',
mcp_servers_count: 1,
mcp_tools: undefined,
mcp_tools_count: undefined,
},

View File

@ -39,8 +39,8 @@ export class StartSessionEvent implements BaseTelemetryEvent {
telemetry_enabled: boolean;
telemetry_log_user_prompts_enabled: boolean;
file_filtering_respect_git_ignore: boolean;
mcp_servers_count?: string;
mcp_tools_count?: string;
mcp_servers_count: number;
mcp_tools_count?: number;
mcp_tools?: string;
constructor(config: Config, toolRegistry?: ToolRegistry) {
@ -70,14 +70,12 @@ export class StartSessionEvent implements BaseTelemetryEvent {
config.getTelemetryLogPromptsEnabled();
this.file_filtering_respect_git_ignore =
config.getFileFilteringRespectGitIgnore();
this.mcp_servers_count = mcpServers
? Object.keys(mcpServers).length.toString()
: '';
this.mcp_servers_count = mcpServers ? Object.keys(mcpServers).length : 0;
if (toolRegistry) {
const mcpTools = toolRegistry
.getAllTools()
.filter((tool) => tool instanceof DiscoveredMCPTool);
this.mcp_tools_count = mcpTools.length.toString();
this.mcp_tools_count = mcpTools.length;
this.mcp_tools = mcpTools
.map((tool) => (tool as DiscoveredMCPTool).name)
.join(',');