mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 13:53:02 -07:00
Co-authored-by: Yuna Seol <yunaseol@google.com>
This commit is contained in:
@@ -181,6 +181,7 @@ describe('UiTelemetryService', () => {
|
||||
thoughts: 2,
|
||||
tool: 3,
|
||||
},
|
||||
roles: {},
|
||||
});
|
||||
expect(service.getLastPromptTokenCount()).toBe(0);
|
||||
});
|
||||
@@ -236,6 +237,7 @@ describe('UiTelemetryService', () => {
|
||||
thoughts: 6,
|
||||
tool: 9,
|
||||
},
|
||||
roles: {},
|
||||
});
|
||||
expect(service.getLastPromptTokenCount()).toBe(0);
|
||||
});
|
||||
@@ -311,6 +313,7 @@ describe('UiTelemetryService', () => {
|
||||
thoughts: 0,
|
||||
tool: 0,
|
||||
},
|
||||
roles: {},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -356,6 +359,35 @@ describe('UiTelemetryService', () => {
|
||||
thoughts: 2,
|
||||
tool: 3,
|
||||
},
|
||||
roles: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should update role metrics when processing an ApiErrorEvent with a role', () => {
|
||||
const event = {
|
||||
'event.name': EVENT_API_ERROR,
|
||||
model: 'gemini-2.5-pro',
|
||||
duration_ms: 300,
|
||||
error: 'Something went wrong',
|
||||
role: 'utility_tool',
|
||||
} as unknown as ApiErrorEvent & { 'event.name': typeof EVENT_API_ERROR };
|
||||
|
||||
service.addEvent(event);
|
||||
|
||||
const metrics = service.getMetrics();
|
||||
expect(metrics.models['gemini-2.5-pro'].roles['utility_tool']).toEqual({
|
||||
totalRequests: 1,
|
||||
totalErrors: 1,
|
||||
totalLatencyMs: 300,
|
||||
tokens: {
|
||||
input: 0,
|
||||
prompt: 0,
|
||||
candidates: 0,
|
||||
total: 0,
|
||||
cached: 0,
|
||||
thoughts: 0,
|
||||
tool: 0,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user