Merge pull request #1717 from pikasTech/fix/2474-web-probe-synthetic-retention
fix: 区分 Trace 摘要与真实行保留
This commit is contained in:
@@ -84,6 +84,7 @@ test("Workbench 产品 Trace 可读性源码解析独立 YAML 时序并识别终
|
||||
mode: "window-progress",
|
||||
passed: true,
|
||||
retainedRowCount: 0,
|
||||
retainedConcreteRowCount: 0,
|
||||
runningEventCount: 121,
|
||||
terminalEventCount: 122,
|
||||
runningSourceSeqMin: 1,
|
||||
@@ -92,6 +93,46 @@ test("Workbench 产品 Trace 可读性源码解析独立 YAML 时序并识别终
|
||||
terminalSourceSeqMax: 121,
|
||||
valuesRedacted: true,
|
||||
});
|
||||
assert.deepEqual(helpers.workbenchTraceReadabilityRetention({
|
||||
rowIdentities: ["source:18:trace-noise-summary"],
|
||||
disclosure: { eventCount: 25, rowWindowed: false },
|
||||
sourceSeqMin: 18,
|
||||
sourceSeqMax: 18,
|
||||
}, {
|
||||
rowIdentities: ["source:21:event:evt_fixture", "source:42:terminal:evt_terminal"],
|
||||
disclosure: { eventCount: 50, rowWindowed: false },
|
||||
sourceSeqMin: 21,
|
||||
sourceSeqMax: 42,
|
||||
}), {
|
||||
mode: "summary-progress",
|
||||
passed: true,
|
||||
retainedRowCount: 0,
|
||||
retainedConcreteRowCount: 0,
|
||||
runningEventCount: 25,
|
||||
terminalEventCount: 50,
|
||||
runningSourceSeqMin: 18,
|
||||
runningSourceSeqMax: 18,
|
||||
terminalSourceSeqMin: 21,
|
||||
terminalSourceSeqMax: 42,
|
||||
valuesRedacted: true,
|
||||
});
|
||||
assert.deepEqual(helpers.workbenchTraceReadabilityRetention({
|
||||
rowIdentities: ["source:18:event:evt_running"],
|
||||
disclosure: { eventCount: 25, rowWindowed: false },
|
||||
sourceSeqMin: 18,
|
||||
sourceSeqMax: 18,
|
||||
}, {
|
||||
rowIdentities: ["source:21:event:evt_terminal"],
|
||||
disclosure: { eventCount: 50, rowWindowed: false },
|
||||
sourceSeqMin: 21,
|
||||
sourceSeqMax: 21,
|
||||
}), {
|
||||
mode: "identity-overlap",
|
||||
passed: false,
|
||||
retainedRowCount: 0,
|
||||
retainedConcreteRowCount: 0,
|
||||
valuesRedacted: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("运行卡片命中后使用 traceId 稳定定位,不随状态变更漂移", async () => {
|
||||
|
||||
@@ -475,15 +475,10 @@ function workbenchTraceReadabilityRetention(running, terminal) {
|
||||
const runningRowIds = new Set(running?.rowIdentities || []);
|
||||
const terminalRowIds = new Set(terminal?.rowIdentities || []);
|
||||
const retainedRowCount = [...runningRowIds].filter((identity) => terminalRowIds.has(identity)).length;
|
||||
const concreteRunningRowIds = [...runningRowIds].filter((identity) => !identity.endsWith(":trace-noise-summary"));
|
||||
const retainedConcreteRowCount = concreteRunningRowIds.filter((identity) => terminalRowIds.has(identity)).length;
|
||||
const summaryOnly = runningRowIds.size > 0 && concreteRunningRowIds.length === 0;
|
||||
const windowed = terminal?.disclosure?.rowWindowed === true;
|
||||
if (!windowed) {
|
||||
return {
|
||||
mode: "identity-overlap",
|
||||
passed: retainedRowCount > 0,
|
||||
retainedRowCount,
|
||||
valuesRedacted: true
|
||||
};
|
||||
}
|
||||
const runningEventCount = running?.disclosure?.eventCount;
|
||||
const terminalEventCount = terminal?.disclosure?.eventCount;
|
||||
const countsAdvance = Number.isInteger(runningEventCount)
|
||||
@@ -495,10 +490,20 @@ function workbenchTraceReadabilityRetention(running, terminal) {
|
||||
&& Number.isInteger(terminal?.sourceSeqMax)
|
||||
&& terminal.sourceSeqMin >= running.sourceSeqMin
|
||||
&& terminal.sourceSeqMax >= running.sourceSeqMax;
|
||||
if (!windowed && !summaryOnly) {
|
||||
return {
|
||||
mode: "identity-overlap",
|
||||
passed: retainedConcreteRowCount > 0,
|
||||
retainedRowCount,
|
||||
retainedConcreteRowCount,
|
||||
valuesRedacted: true
|
||||
};
|
||||
}
|
||||
return {
|
||||
mode: "window-progress",
|
||||
mode: windowed ? "window-progress" : "summary-progress",
|
||||
passed: countsAdvance && sequenceWindowAdvances,
|
||||
retainedRowCount,
|
||||
retainedConcreteRowCount,
|
||||
runningEventCount: runningEventCount ?? null,
|
||||
terminalEventCount: terminalEventCount ?? null,
|
||||
runningSourceSeqMin: running?.sourceSeqMin ?? null,
|
||||
|
||||
Reference in New Issue
Block a user