feat: record first token latency in runtime router
This commit is contained in:
@@ -155,6 +155,10 @@ function summarizeRuntime(runtimeJson) {
|
||||
streamOpenCount: worker.streamOpenCount,
|
||||
streamAbortCount: worker.streamAbortCount,
|
||||
streamErrorCount: worker.streamErrorCount,
|
||||
ewmaFirstTokenMs: worker.ewmaFirstTokenMs,
|
||||
lastFirstTokenMs: worker.lastFirstTokenMs,
|
||||
lastFirstTokenAt: worker.lastFirstTokenAt,
|
||||
firstTokenCount: worker.firstTokenCount,
|
||||
cpuLoad: worker.cpuLoad,
|
||||
memoryPressure: worker.memoryPressure,
|
||||
fdPressure: worker.fdPressure,
|
||||
@@ -213,6 +217,7 @@ for (const worker of runtimeSummary?.workers ?? []) {
|
||||
if (worker.containerHealth && worker.containerHealth !== 'healthy') failures.push(`${worker.id}_container_${worker.containerHealth}`);
|
||||
if (!worker.metricsFresh) failures.push(`${worker.id}_metrics_stale`);
|
||||
if (worker.streamErrorCount > 0) failures.push(`${worker.id}_stream_errors_${worker.streamErrorCount}`);
|
||||
if (worker.firstTokenCount > 0 && worker.ewmaFirstTokenMs <= 0) failures.push(`${worker.id}_first_token_ewma_missing`);
|
||||
}
|
||||
if (runtimeSummary?.toolRuntime?.chatInjectsCodeTools !== false) failures.push('chat_injects_code_tools');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user