fix: 压缩精确内存回收计划输出

This commit is contained in:
pikastech
2026-07-21 14:06:11 +02:00
parent 8350b6ced5
commit 948cdd29c3
+6 -2
View File
@@ -439,13 +439,16 @@ function compactMemoryPressureCandidate(value: unknown): Record<string, unknown>
action: { op: action.op, allowlist: action.allowlist },
};
if (candidate.kind === "cgroup-memory-reclaim") {
const memoryStat = recordOrEmpty(candidate.memoryStat);
return {
...base,
id: candidate.id,
kind: candidate.kind,
configId: candidate.configId,
reason: candidate.reason,
risk: candidate.risk,
path: candidate.path,
workloadSelector: compactWorkloadSelector(candidate.workloadSelector),
resolvedPod: compactResolvedPod(candidate.resolvedPod),
reclaimBytes: candidate.reclaimBytes,
requestedMemoryReclaimBytes: candidate.requestedMemoryReclaimBytes,
requestedMemoryReclaim: candidate.requestedMemoryReclaim,
estimateKind: candidate.estimateKind,
@@ -453,6 +456,7 @@ function compactMemoryPressureCandidate(value: unknown): Record<string, unknown>
minimumInactiveAnonBytes: candidate.minimumInactiveAnonBytes,
memoryCurrentBytes: candidate.memoryCurrentBytes,
memorySwapCurrentBytes: candidate.memorySwapCurrentBytes,
inactiveAnonBytes: memoryStat.inactive_anon,
};
}
const identities = Array.isArray(candidate.processIdentities) ? candidate.processIdentities.map(recordOrEmpty) : [];