mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-17 21:40:39 -07:00
Merge branch 'main' into chore/migrate-to-tsgo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@google/gemini-cli-test-utils",
|
||||
"version": "0.39.0-nightly.20260408.e77b22e63",
|
||||
"version": "0.40.0-nightly.20260414.g5b1f7375a",
|
||||
"private": true,
|
||||
"main": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -147,7 +147,9 @@ export class PerfTestHarness {
|
||||
throw new Error(`No active timer found for label "${label}"`);
|
||||
}
|
||||
|
||||
const wallClockMs = performance.now() - timer.startTime;
|
||||
// Round wall-clock time to nearest 0.1 ms
|
||||
const wallClockMs =
|
||||
Math.round((performance.now() - timer.startTime) * 10) / 10;
|
||||
const cpuDelta = process.cpuUsage(timer.startCpuUsage);
|
||||
this.activeTimers.delete(label);
|
||||
|
||||
|
||||
@@ -193,6 +193,28 @@ export function checkModelOutputContent(
|
||||
return isValid;
|
||||
}
|
||||
|
||||
export interface MetricDataPoint {
|
||||
attributes?: Record<string, unknown>;
|
||||
value?: {
|
||||
sum?: number;
|
||||
min?: number;
|
||||
max?: number;
|
||||
count?: number;
|
||||
};
|
||||
startTime?: [number, number];
|
||||
endTime?: string;
|
||||
}
|
||||
|
||||
export interface TelemetryMetric {
|
||||
descriptor: {
|
||||
name: string;
|
||||
type?: string;
|
||||
description?: string;
|
||||
unit?: string;
|
||||
};
|
||||
dataPoints: MetricDataPoint[];
|
||||
}
|
||||
|
||||
export interface ParsedLog {
|
||||
attributes?: {
|
||||
'event.name'?: string;
|
||||
@@ -213,11 +235,7 @@ export interface ParsedLog {
|
||||
prompt_id?: string;
|
||||
};
|
||||
scopeMetrics?: {
|
||||
metrics: {
|
||||
descriptor: {
|
||||
name: string;
|
||||
};
|
||||
}[];
|
||||
metrics: TelemetryMetric[];
|
||||
}[];
|
||||
}
|
||||
|
||||
@@ -1297,6 +1315,10 @@ export class TestRig {
|
||||
return logs;
|
||||
}
|
||||
|
||||
readTelemetryLogs(): ParsedLog[] {
|
||||
return this._readAndParseTelemetryLog();
|
||||
}
|
||||
|
||||
private _readAndParseTelemetryLog(): ParsedLog[] {
|
||||
// Telemetry is always written to the test directory
|
||||
const logFilePath = join(this.homeDir!, 'telemetry.log');
|
||||
@@ -1450,7 +1472,7 @@ export class TestRig {
|
||||
);
|
||||
}
|
||||
|
||||
readMetric(metricName: string): Record<string, unknown> | null {
|
||||
readMetric(metricName: string): TelemetryMetric | null {
|
||||
const logs = this._readAndParseTelemetryLog();
|
||||
for (const logData of logs) {
|
||||
if (logData.scopeMetrics) {
|
||||
|
||||
Reference in New Issue
Block a user