mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -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)
|
||||
- `decision` (string: "accept", "reject", or "modify", 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.
|
||||
- **Attributes**:
|
||||
@@ -379,14 +387,6 @@ Metrics are numerical measurements of behavior over time.
|
||||
- `lines` (Int, if applicable): Number of lines in the file.
|
||||
- `mimetype` (string, if applicable): Mimetype 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
|
||||
of the file.
|
||||
|
||||
|
||||
@@ -694,6 +694,10 @@ describe('loggers', () => {
|
||||
success: true,
|
||||
decision: ToolCallDecision.ACCEPT,
|
||||
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,
|
||||
decision: event.decision,
|
||||
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;
|
||||
decision?: 'accept' | 'reject' | 'modify' | 'auto_accept';
|
||||
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]: {
|
||||
|
||||
Reference in New Issue
Block a user