mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
feat(telemetry): Add extensions to StartSessionEvent telemetry (#12261)
Co-authored-by: Shnatu <snatu@google.com>
This commit is contained in:
@@ -251,6 +251,9 @@ Captures startup configuration and user prompt submissions.
|
|||||||
- `debug_mode` (boolean)
|
- `debug_mode` (boolean)
|
||||||
- `mcp_servers` (string)
|
- `mcp_servers` (string)
|
||||||
- `mcp_servers_count` (int)
|
- `mcp_servers_count` (int)
|
||||||
|
- `extensions` (string)
|
||||||
|
- `extension_ids` (string)
|
||||||
|
- `extension_count` (int)
|
||||||
- `mcp_tools` (string, if applicable)
|
- `mcp_tools` (string, if applicable)
|
||||||
- `mcp_tools_count` (int, if applicable)
|
- `mcp_tools_count` (int, if applicable)
|
||||||
- `output_format` ("text", "json", or "stream-json")
|
- `output_format` ("text", "json", or "stream-json")
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ export class ClearcutLogger {
|
|||||||
EventMetadataKey.GEMINI_CLI_START_SESSION_EXTENSIONS_COUNT,
|
EventMetadataKey.GEMINI_CLI_START_SESSION_EXTENSIONS_COUNT,
|
||||||
value: event.extensions_count.toString(),
|
value: event.extensions_count.toString(),
|
||||||
},
|
},
|
||||||
|
// We deliberately do not log the names of extensions here, to be safe.
|
||||||
{
|
{
|
||||||
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_EXTENSION_IDS,
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_EXTENSION_IDS,
|
||||||
value: event.extension_ids.toString(),
|
value: event.extension_ids.toString(),
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ import * as metrics from './metrics.js';
|
|||||||
import { FileOperation } from './metrics.js';
|
import { FileOperation } from './metrics.js';
|
||||||
import * as sdk from './sdk.js';
|
import * as sdk from './sdk.js';
|
||||||
import { vi, describe, beforeEach, it, expect, afterEach } from 'vitest';
|
import { vi, describe, beforeEach, it, expect, afterEach } from 'vitest';
|
||||||
|
import { type GeminiCLIExtension } from '@google/gemini-cli-core';
|
||||||
import {
|
import {
|
||||||
FinishReason,
|
FinishReason,
|
||||||
type CallableTool,
|
type CallableTool,
|
||||||
@@ -200,7 +201,11 @@ describe('loggers', () => {
|
|||||||
getTargetDir: () => 'target-dir',
|
getTargetDir: () => 'target-dir',
|
||||||
getProxy: () => 'http://test.proxy.com:8080',
|
getProxy: () => 'http://test.proxy.com:8080',
|
||||||
getOutputFormat: () => OutputFormat.JSON,
|
getOutputFormat: () => OutputFormat.JSON,
|
||||||
getExtensions: () => [],
|
getExtensions: () =>
|
||||||
|
[
|
||||||
|
{ name: 'ext-one', id: 'id-one' },
|
||||||
|
{ name: 'ext-two', id: 'id-two' },
|
||||||
|
] as GeminiCLIExtension[],
|
||||||
} as unknown as Config;
|
} as unknown as Config;
|
||||||
|
|
||||||
const startSessionEvent = new StartSessionEvent(mockConfig);
|
const startSessionEvent = new StartSessionEvent(mockConfig);
|
||||||
@@ -229,8 +234,9 @@ describe('loggers', () => {
|
|||||||
mcp_tools: undefined,
|
mcp_tools: undefined,
|
||||||
mcp_tools_count: undefined,
|
mcp_tools_count: undefined,
|
||||||
output_format: 'json',
|
output_format: 'json',
|
||||||
extension_ids: '',
|
extension_ids: 'id-one,id-two',
|
||||||
extensions_count: 0,
|
extensions_count: 2,
|
||||||
|
extensions: 'ext-one,ext-two',
|
||||||
auth_type: 'vertex-ai',
|
auth_type: 'vertex-ai',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export class StartSessionEvent implements BaseTelemetryEvent {
|
|||||||
mcp_tools?: string;
|
mcp_tools?: string;
|
||||||
output_format: OutputFormat;
|
output_format: OutputFormat;
|
||||||
extensions_count: number;
|
extensions_count: number;
|
||||||
|
extensions: string;
|
||||||
extension_ids: string;
|
extension_ids: string;
|
||||||
auth_type?: string;
|
auth_type?: string;
|
||||||
|
|
||||||
@@ -102,6 +103,7 @@ export class StartSessionEvent implements BaseTelemetryEvent {
|
|||||||
this.output_format = config.getOutputFormat();
|
this.output_format = config.getOutputFormat();
|
||||||
const extensions = config.getExtensions();
|
const extensions = config.getExtensions();
|
||||||
this.extensions_count = extensions.length;
|
this.extensions_count = extensions.length;
|
||||||
|
this.extensions = extensions.map((e) => e.name).join(',');
|
||||||
this.extension_ids = extensions.map((e) => e.id).join(',');
|
this.extension_ids = extensions.map((e) => e.id).join(',');
|
||||||
this.auth_type = generatorConfig?.authType;
|
this.auth_type = generatorConfig?.authType;
|
||||||
if (toolRegistry) {
|
if (toolRegistry) {
|
||||||
@@ -135,6 +137,7 @@ export class StartSessionEvent implements BaseTelemetryEvent {
|
|||||||
mcp_tools: this.mcp_tools,
|
mcp_tools: this.mcp_tools,
|
||||||
mcp_tools_count: this.mcp_tools_count,
|
mcp_tools_count: this.mcp_tools_count,
|
||||||
output_format: this.output_format,
|
output_format: this.output_format,
|
||||||
|
extensions: this.extensions,
|
||||||
extensions_count: this.extensions_count,
|
extensions_count: this.extensions_count,
|
||||||
extension_ids: this.extension_ids,
|
extension_ids: this.extension_ids,
|
||||||
auth_type: this.auth_type,
|
auth_type: this.auth_type,
|
||||||
|
|||||||
Reference in New Issue
Block a user