mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-30 15:04:16 -07:00
feat(telemetry): Add extension name to ToolCallEvent telemetry (#12343)
Co-authored-by: Shnatu <snatu@google.com>
This commit is contained in:
@@ -281,6 +281,8 @@ Captures tool executions, output truncation, and Smart Edit behavior.
|
|||||||
- `prompt_id` (string)
|
- `prompt_id` (string)
|
||||||
- `tool_type` ("native" or "mcp")
|
- `tool_type` ("native" or "mcp")
|
||||||
- `mcp_server_name` (string, if applicable)
|
- `mcp_server_name` (string, if applicable)
|
||||||
|
- `extension_name` (string, if applicable)
|
||||||
|
- `extension_id` (string, if applicable)
|
||||||
- `content_length` (int, if applicable)
|
- `content_length` (int, if applicable)
|
||||||
- `metadata` (if applicable)
|
- `metadata` (if applicable)
|
||||||
|
|
||||||
|
|||||||
@@ -1244,6 +1244,7 @@ describe('loggers', () => {
|
|||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
'test-extension',
|
'test-extension',
|
||||||
|
'test-extension-id',
|
||||||
);
|
);
|
||||||
|
|
||||||
const call: CompletedToolCall = {
|
const call: CompletedToolCall = {
|
||||||
@@ -1278,7 +1279,8 @@ describe('loggers', () => {
|
|||||||
'installation.id': 'test-installation-id',
|
'installation.id': 'test-installation-id',
|
||||||
'event.name': EVENT_TOOL_CALL,
|
'event.name': EVENT_TOOL_CALL,
|
||||||
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
||||||
extension_id: 'test-extension',
|
extension_name: 'test-extension',
|
||||||
|
extension_id: 'test-extension-id',
|
||||||
function_name: 'mock_mcp_tool',
|
function_name: 'mock_mcp_tool',
|
||||||
function_args: JSON.stringify(
|
function_args: JSON.stringify(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ export class ToolCallEvent implements BaseTelemetryEvent {
|
|||||||
tool_type: 'native' | 'mcp';
|
tool_type: 'native' | 'mcp';
|
||||||
content_length?: number;
|
content_length?: number;
|
||||||
mcp_server_name?: string;
|
mcp_server_name?: string;
|
||||||
|
extension_name?: string;
|
||||||
extension_id?: string;
|
extension_id?: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: { [key: string]: any };
|
metadata?: { [key: string]: any };
|
||||||
@@ -269,6 +270,7 @@ export class ToolCallEvent implements BaseTelemetryEvent {
|
|||||||
) {
|
) {
|
||||||
this.tool_type = 'mcp';
|
this.tool_type = 'mcp';
|
||||||
this.mcp_server_name = call.tool.serverName;
|
this.mcp_server_name = call.tool.serverName;
|
||||||
|
this.extension_name = call.tool.extensionName;
|
||||||
this.extension_id = call.tool.extensionId;
|
this.extension_id = call.tool.extensionId;
|
||||||
} else {
|
} else {
|
||||||
this.tool_type = 'native';
|
this.tool_type = 'native';
|
||||||
@@ -319,6 +321,7 @@ export class ToolCallEvent implements BaseTelemetryEvent {
|
|||||||
tool_type: this.tool_type,
|
tool_type: this.tool_type,
|
||||||
content_length: this.content_length,
|
content_length: this.content_length,
|
||||||
mcp_server_name: this.mcp_server_name,
|
mcp_server_name: this.mcp_server_name,
|
||||||
|
extension_name: this.extension_name,
|
||||||
extension_id: this.extension_id,
|
extension_id: this.extension_id,
|
||||||
metadata: this.metadata,
|
metadata: this.metadata,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -628,6 +628,7 @@ export async function discoverTools(
|
|||||||
mcpServerConfig.trust,
|
mcpServerConfig.trust,
|
||||||
undefined,
|
undefined,
|
||||||
cliConfig,
|
cliConfig,
|
||||||
|
mcpServerConfig.extension?.name,
|
||||||
mcpServerConfig.extension?.id,
|
mcpServerConfig.extension?.id,
|
||||||
messageBus,
|
messageBus,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ export class DiscoveredMCPTool extends BaseDeclarativeTool<
|
|||||||
readonly trust?: boolean,
|
readonly trust?: boolean,
|
||||||
nameOverride?: string,
|
nameOverride?: string,
|
||||||
private readonly cliConfig?: Config,
|
private readonly cliConfig?: Config,
|
||||||
|
override readonly extensionName?: string,
|
||||||
override readonly extensionId?: string,
|
override readonly extensionId?: string,
|
||||||
messageBus?: MessageBus,
|
messageBus?: MessageBus,
|
||||||
) {
|
) {
|
||||||
@@ -230,6 +231,7 @@ export class DiscoveredMCPTool extends BaseDeclarativeTool<
|
|||||||
true, // isOutputMarkdown
|
true, // isOutputMarkdown
|
||||||
false, // canUpdateOutput,
|
false, // canUpdateOutput,
|
||||||
messageBus,
|
messageBus,
|
||||||
|
extensionName,
|
||||||
extensionId,
|
extensionId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -244,6 +246,7 @@ export class DiscoveredMCPTool extends BaseDeclarativeTool<
|
|||||||
this.trust,
|
this.trust,
|
||||||
`${this.serverName}__${this.serverToolName}`,
|
`${this.serverName}__${this.serverToolName}`,
|
||||||
this.cliConfig,
|
this.cliConfig,
|
||||||
|
this.extensionName,
|
||||||
this.extensionId,
|
this.extensionId,
|
||||||
this.messageBus,
|
this.messageBus,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ export abstract class DeclarativeTool<
|
|||||||
readonly isOutputMarkdown: boolean = true,
|
readonly isOutputMarkdown: boolean = true,
|
||||||
readonly canUpdateOutput: boolean = false,
|
readonly canUpdateOutput: boolean = false,
|
||||||
readonly messageBus?: MessageBus,
|
readonly messageBus?: MessageBus,
|
||||||
|
readonly extensionName?: string,
|
||||||
readonly extensionId?: string,
|
readonly extensionId?: string,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user