降低资源监控页自动探针频率

This commit is contained in:
liuwei
2026-05-06 10:46:29 +08:00
parent 3ea3483d6a
commit eab9da94bb

View File

@@ -329,6 +329,11 @@
md2imgLoading: false,
md2imgWarming: false,
autoRefreshTimer: null,
// 资源监控页默认走“低频观察”模式:
// 1. 你当前更依赖邮件告警,而不是盯着面板秒级刷新;
// 2. 把轮询频率降到 30 秒,可以明显减少无意义请求;
// 3. 同时还能保留基础趋势观察能力,适合日常巡检。
autoRefreshIntervalMs: 30000,
md2imgHealth: null,
trendHistory: {
cpu: [],
@@ -488,10 +493,14 @@
this.currentView = '14';
this.loadStatusOverview(false);
this.loadMd2ImgHealth();
// 资源页采用前端轮询即可满足日常观察,不需要为了监控再起单独守护进程。
// 资源页继续采用前端轮询即可满足日常观察,不需要为了监控再起单独守护进程。
// 这里改成更低频的 30 秒:
// 1. 减少后台接口请求频率;
// 2. 更贴合“异常靠邮件提醒,页面只做巡检”的使用方式;
// 3. 仍然足够支撑人工查看当前机器状态。
this.autoRefreshTimer = setInterval(() => {
this.loadStatusOverview(false);
}, 10000);
}, this.autoRefreshIntervalMs);
},
beforeDestroy() {
if (this.autoRefreshTimer) {
@@ -545,7 +554,11 @@
value: numeric,
timestamp: Date.now()
});
// 只保留最近 18 个点,10 秒轮询时大约能覆盖近 3 分钟。
// 只保留最近 18 个点,30 秒轮询时大约能覆盖近 9 分钟。
// 这个窗口故意不做太长:
// 1. 目标是给当前巡检提供“最近一段时间”的趋势感知;
// 2. 再长就更适合落库做历史监控,而不是页面内存态缓存;
// 3. 对你现在的运维习惯来说9 分钟窗口已经足够判断是否持续抬升。
while (next.length > 18) {
next.shift();
}