mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
fix(routing): Round latency to integer for telemetry (#9242)
This commit is contained in:
@@ -92,17 +92,18 @@ export class CompositeStrategy implements TerminalStrategy {
|
|||||||
startTime: number,
|
startTime: number,
|
||||||
): RoutingDecision {
|
): RoutingDecision {
|
||||||
const endTime = performance.now();
|
const endTime = performance.now();
|
||||||
const totalLatency = endTime - startTime;
|
|
||||||
|
|
||||||
// Combine the source paths: composite_name/child_source (e.g. 'router/default')
|
|
||||||
const compositeSource = `${this.name}/${decision.metadata.source}`;
|
const compositeSource = `${this.name}/${decision.metadata.source}`;
|
||||||
|
|
||||||
|
// Use the child's latency if it's a meaningful (non-zero) value,
|
||||||
|
// otherwise use the total time spent in the composite strategy.
|
||||||
|
const latency = decision.metadata.latencyMs || endTime - startTime;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...decision,
|
...decision,
|
||||||
metadata: {
|
metadata: {
|
||||||
...decision.metadata,
|
...decision.metadata,
|
||||||
source: compositeSource,
|
source: compositeSource,
|
||||||
latencyMs: decision.metadata.latencyMs || totalLatency,
|
latencyMs: Math.round(latency), // Round to ensure int for telemetry.
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user