mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
feat(telemetry): add diff stats to tool call metrics (#10819)
This commit is contained in:
@@ -345,6 +345,14 @@ Metrics are numerical measurements of behavior over time.
|
|||||||
- `success` (boolean)
|
- `success` (boolean)
|
||||||
- `decision` (string: "accept", "reject", or "modify", if applicable)
|
- `decision` (string: "accept", "reject", or "modify", if applicable)
|
||||||
- `tool_type` (string: "mcp", or "native", if applicable)
|
- `tool_type` (string: "mcp", or "native", if applicable)
|
||||||
|
- `model_added_lines` (Int, optional): Lines added by model in the proposed
|
||||||
|
changes, if applicable
|
||||||
|
- `model_removed_lines` (Int, optional): Lines removed by model in the
|
||||||
|
proposed changes, if applicable
|
||||||
|
- `user_added_lines` (Int, optional): Lines added by user edits after model
|
||||||
|
proposal, if applicable
|
||||||
|
- `user_removed_lines` (Int, optional): Lines removed by user edits after
|
||||||
|
model proposal, if applicable
|
||||||
|
|
||||||
- `gemini_cli.tool.call.latency` (Histogram, ms): Measures tool call latency.
|
- `gemini_cli.tool.call.latency` (Histogram, ms): Measures tool call latency.
|
||||||
- **Attributes**:
|
- **Attributes**:
|
||||||
@@ -379,14 +387,6 @@ Metrics are numerical measurements of behavior over time.
|
|||||||
- `lines` (Int, if applicable): Number of lines in the file.
|
- `lines` (Int, if applicable): Number of lines in the file.
|
||||||
- `mimetype` (string, if applicable): Mimetype of the file.
|
- `mimetype` (string, if applicable): Mimetype of the file.
|
||||||
- `extension` (string, if applicable): File extension of the file.
|
- `extension` (string, if applicable): File extension of the file.
|
||||||
- `model_added_lines` (Int, if applicable): Number of lines added/changed by
|
|
||||||
the model.
|
|
||||||
- `model_removed_lines` (Int, if applicable): Number of lines
|
|
||||||
removed/changed by the model.
|
|
||||||
- `user_added_lines` (Int, if applicable): Number of lines added/changed by
|
|
||||||
user in AI proposed changes.
|
|
||||||
- `user_removed_lines` (Int, if applicable): Number of lines removed/changed
|
|
||||||
by user in AI proposed changes.
|
|
||||||
- `programming_language` (string, if applicable): The programming language
|
- `programming_language` (string, if applicable): The programming language
|
||||||
of the file.
|
of the file.
|
||||||
|
|
||||||
|
|||||||
@@ -694,6 +694,10 @@ describe('loggers', () => {
|
|||||||
success: true,
|
success: true,
|
||||||
decision: ToolCallDecision.ACCEPT,
|
decision: ToolCallDecision.ACCEPT,
|
||||||
tool_type: 'native',
|
tool_type: 'native',
|
||||||
|
model_added_lines: 1,
|
||||||
|
model_removed_lines: 2,
|
||||||
|
user_added_lines: 5,
|
||||||
|
user_removed_lines: 6,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,14 @@ export function logToolCall(config: Config, event: ToolCallEvent): void {
|
|||||||
success: event.success,
|
success: event.success,
|
||||||
decision: event.decision,
|
decision: event.decision,
|
||||||
tool_type: event.tool_type,
|
tool_type: event.tool_type,
|
||||||
|
...(event.metadata
|
||||||
|
? {
|
||||||
|
model_added_lines: event.metadata['model_added_lines'],
|
||||||
|
model_removed_lines: event.metadata['model_removed_lines'],
|
||||||
|
user_added_lines: event.metadata['user_added_lines'],
|
||||||
|
user_removed_lines: event.metadata['user_removed_lines'],
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ const COUNTER_DEFINITIONS = {
|
|||||||
success: boolean;
|
success: boolean;
|
||||||
decision?: 'accept' | 'reject' | 'modify' | 'auto_accept';
|
decision?: 'accept' | 'reject' | 'modify' | 'auto_accept';
|
||||||
tool_type?: 'native' | 'mcp';
|
tool_type?: 'native' | 'mcp';
|
||||||
|
// Optional diff statistics for file-modifying tools
|
||||||
|
model_added_lines?: number;
|
||||||
|
model_removed_lines?: number;
|
||||||
|
user_added_lines?: number;
|
||||||
|
user_removed_lines?: number;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[API_REQUEST_COUNT]: {
|
[API_REQUEST_COUNT]: {
|
||||||
|
|||||||
Reference in New Issue
Block a user