fix: 为 WebProbe 增加物理内存门禁
This commit is contained in:
@@ -68,6 +68,15 @@ async function writeManifest(extra = {}) {
|
||||
observerInitiatedDefault: false,
|
||||
responseBodyReadDefault: false,
|
||||
},
|
||||
resourceLimits: {
|
||||
maxScreenshots,
|
||||
maxPerformanceEntries,
|
||||
maxBrowserProcessHistoryEntries,
|
||||
maxBrowserFreezeSignalHistoryEntries,
|
||||
responseBodyMaxBytes,
|
||||
webPerformanceRequestBodyMaxBytes,
|
||||
valuesRedacted: true,
|
||||
},
|
||||
alertThresholds,
|
||||
browserFreezePolicy,
|
||||
projectManagement,
|
||||
@@ -100,6 +109,16 @@ async function writeHeartbeat(extra = {}) {
|
||||
maxRunSeconds: maxRunMs > 0 ? Math.ceil(maxRunMs / 1000) : 0,
|
||||
valuesRedacted: true,
|
||||
},
|
||||
resourceLimits: {
|
||||
screenshotCount,
|
||||
maxScreenshots,
|
||||
maxPerformanceEntries,
|
||||
maxBrowserProcessHistoryEntries,
|
||||
maxBrowserFreezeSignalHistoryEntries,
|
||||
responseBodyMaxBytes,
|
||||
webPerformanceRequestBodyMaxBytes,
|
||||
valuesRedacted: true,
|
||||
},
|
||||
lastObserverRefreshAt: Number.isFinite(lastObserverRefreshAtMs) ? new Date(lastObserverRefreshAtMs).toISOString() : null,
|
||||
pageProvenance: compactPageProvenance(currentPageProvenance),
|
||||
sampleSeq,
|
||||
@@ -335,6 +354,7 @@ function recordBrowserFreezeSignal(kind, sample, pageMetric, detail) {
|
||||
const windowMs = browserFreezePolicy.blockerWindowMs;
|
||||
const cutoff = signal.tsMs - windowMs;
|
||||
while (browserFreezeSignalHistory.length > 0 && Number(browserFreezeSignalHistory[0].tsMs || 0) < cutoff) browserFreezeSignalHistory.shift();
|
||||
while (browserFreezeSignalHistory.length > maxBrowserFreezeSignalHistoryEntries) browserFreezeSignalHistory.shift();
|
||||
return {
|
||||
kind,
|
||||
rootCause: detail.rootCause,
|
||||
@@ -639,6 +659,7 @@ function updateBrowserProcessHistory(tsMs, processSummary) {
|
||||
browserProcessHistory.push({ tsMs, totalRssBytes, maxProcessRssBytes });
|
||||
const retentionMs = Math.max(windowMs * 3, 180000);
|
||||
while (browserProcessHistory.length > 0 && tsMs - browserProcessHistory[0].tsMs > retentionMs) browserProcessHistory.shift();
|
||||
while (browserProcessHistory.length > maxBrowserProcessHistoryEntries) browserProcessHistory.shift();
|
||||
const windowStartMs = tsMs - windowMs;
|
||||
const candidates = browserProcessHistory.filter((item) => item.tsMs >= windowStartMs && item.tsMs <= tsMs);
|
||||
const baseline = candidates[0] || browserProcessHistory[0] || null;
|
||||
|
||||
Reference in New Issue
Block a user