fix(web-probe): isolate turn timing columns by round
This commit is contained in:
@@ -1414,6 +1414,8 @@ function detectTurnTimingNonMonotonic(columns, rows) {
|
||||
|
||||
function turnMetricItems(sample, timelineItem) {
|
||||
const promptIndex = timelineItem.promptIndex ?? 0;
|
||||
const sessionKey = sample?.routeSessionId || sample?.activeSessionId || "unknown-session";
|
||||
const roundKey = String(promptIndex);
|
||||
const items = [];
|
||||
if (Array.isArray(sample?.turns) && sample.turns.length > 0) {
|
||||
for (const turn of sample.turns) {
|
||||
@@ -1423,7 +1425,7 @@ function turnMetricItems(sample, timelineItem) {
|
||||
const traceId = turn.traceId || firstTraceId(texts);
|
||||
const messageId = turn.messageId || null;
|
||||
const domIndex = Number.isFinite(Number(turn.index)) ? Number(turn.index) : items.length;
|
||||
const key = "turn:dom-index-" + String(domIndex);
|
||||
const key = "turn:" + sessionKey + ":round-" + roundKey + ":dom-index-" + String(domIndex);
|
||||
items.push({
|
||||
key,
|
||||
source: "turn",
|
||||
@@ -1447,7 +1449,7 @@ function turnMetricItems(sample, timelineItem) {
|
||||
if (totalElapsedValues.length === 0 && recentUpdateValues.length === 0) continue;
|
||||
const domIndex = Number.isFinite(Number(message.index)) ? Number(message.index) : items.length;
|
||||
items.push({
|
||||
key: "message:" + String(domIndex),
|
||||
key: "message:" + sessionKey + ":round-" + roundKey + ":dom-index-" + String(domIndex),
|
||||
source: "message",
|
||||
promptIndex,
|
||||
traceId: firstTraceId([text]),
|
||||
@@ -1463,7 +1465,7 @@ function turnMetricItems(sample, timelineItem) {
|
||||
}
|
||||
if (timelineItem.totalElapsedSeconds !== null || timelineItem.recentUpdateSeconds !== null) {
|
||||
return [{
|
||||
key: "aggregate-prompt:" + String(promptIndex),
|
||||
key: "aggregate:" + sessionKey + ":round-" + roundKey,
|
||||
source: "aggregate",
|
||||
promptIndex,
|
||||
traceId: null,
|
||||
|
||||
Reference in New Issue
Block a user