fix(web-probe): aggregate numeric sse flush replacements
This commit is contained in:
@@ -718,6 +718,7 @@ function extractWebPerformanceRuntimeDiagnostics(network, promptTimes) {
|
||||
sessionIdHash: event.sessionIdHash ?? null,
|
||||
eventIdHash: event.eventIdHash ?? null,
|
||||
eventCount: numberOrNull(event.eventCount),
|
||||
deliveredCount: numberOrNull(event.deliveredCount),
|
||||
chunkCount: numberOrNull(event.chunkCount),
|
||||
flushDurationMs: numberOrNull(event.flushDurationMs),
|
||||
droppedCount: numberOrNull(event.droppedCount),
|
||||
@@ -788,6 +789,7 @@ function groupWebPerformanceRuntimeDiagnostics(events) {
|
||||
promptIndexes: new Set(),
|
||||
traceIds: new Set(),
|
||||
eventCount: 0,
|
||||
deliveredCount: 0,
|
||||
chunkCount: 0,
|
||||
droppedCount: 0,
|
||||
maxFlushDurationMs: null,
|
||||
@@ -802,16 +804,19 @@ function groupWebPerformanceRuntimeDiagnostics(events) {
|
||||
if (Number.isFinite(Number(item.promptIndex))) group.promptIndexes.add(Number(item.promptIndex));
|
||||
if (item.traceId) group.traceIds.add(String(item.traceId));
|
||||
group.eventCount += Number(item.eventCount || 0);
|
||||
group.deliveredCount += Number(item.deliveredCount || 0);
|
||||
group.chunkCount += Number(item.chunkCount || 0);
|
||||
group.droppedCount += Number(item.droppedCount || 0);
|
||||
group.maxFlushDurationMs = maxNumber(group.maxFlushDurationMs, item.flushDurationMs);
|
||||
group.maxItemsPerChunk = maxNumber(group.maxItemsPerChunk, item.maxItemsPerChunk);
|
||||
group.maxChunkMs = maxNumber(group.maxChunkMs, item.maxChunkMs);
|
||||
if (item.replacedByKey === true || item.replacedByKeyHash) group.replacedByKeyCount += 1;
|
||||
if (Number.isFinite(Number(item.replacedByKey))) group.replacedByKeyCount += Number(item.replacedByKey);
|
||||
else if (item.replacedByKey === true || item.replacedByKeyHash) group.replacedByKeyCount += 1;
|
||||
if (group.examples.length < 6) group.examples.push({
|
||||
ts: item.ts || null,
|
||||
traceId: item.traceId || null,
|
||||
eventCount: item.eventCount ?? null,
|
||||
deliveredCount: item.deliveredCount ?? null,
|
||||
chunkCount: item.chunkCount ?? null,
|
||||
flushDurationMs: item.flushDurationMs ?? null,
|
||||
droppedCount: item.droppedCount ?? null,
|
||||
@@ -834,6 +839,7 @@ function groupWebPerformanceRuntimeDiagnostics(events) {
|
||||
promptIndexes: Array.from(item.promptIndexes).sort((a, b) => a - b),
|
||||
traceIds: Array.from(item.traceIds).sort().slice(0, 12),
|
||||
eventCount: item.eventCount,
|
||||
deliveredCount: item.deliveredCount,
|
||||
chunkCount: item.chunkCount,
|
||||
droppedCount: item.droppedCount,
|
||||
maxFlushDurationMs: item.maxFlushDurationMs,
|
||||
|
||||
Reference in New Issue
Block a user