Repository navigation
feat: 历史分两层存储,保留天数上限 365、默认 30 - #81
Merged
Merged
Conversation
- 分钟明细最多保留 7 天,更早的每小时汇总进 metric_hour / ping_hour,按保留天数清理 - 超过 7 天的图表窗口读小时汇总;窗口上限改为保留天数,登录与匿名相同,/api/me 返回 history_days - 每小时的清理改按节点定位、分片执行并挪出 runtime;数据页的历史跨度改按节点定位 - 设置页的保留天数加问号说明,回收空间的文案改为约两倍的空闲磁盘
按分层存储后的规模:300 台节点、每台 4 个延迟监控保留一年,库约 720 MiB,原来的 256 MiB 导不回去。导入 1 GiB 持锁 14–27 秒,在 agent 重连的 90 秒之内。
This was referenced Sep 29, 2026
# Conflicts: # web-admin/src/components/Admin.tsx
- 汇总与清理每一步重新读取水位线:追补进行中恢复备份,不会跳过或删掉恢复出的历史;水位线早于保留期时直接从保留期起点汇总 - 汇总失败时照常清理 - 超过 7 天的窗口最多读最近一周的分钟明细,追补期间的宽窗口不再扫全部明细 - 收到停止信号后,汇总与清理在当前一步结束即返回 - 迁移时删掉旧版删节点、删探测后留在 ping_hour 的行
设置页问号改为说明默认 30 天、季付填 92、年付填 365,占位符同步
- 保留天数的问号改为说明默认 30 天、上限 365 天 - 每个问号取段落行数最少的最窄宽度;屏幕放不下时改用同样行数能容纳的最窄宽度,不按屏宽截断
- 分钟明细记下一分钟里最高的 CPU 占用,与网速峰值同样按 agent 的上报间隔测得;小时汇总取其最高 - 图表的每个点返回 cpu_max 与 minutes(有数据的分钟数),主题可以据此积分流量、画在线率 - 小时汇总同时保留 swap、TCP/UDP 连接数与进程数的平均值,计数四舍五入
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
保留天数原来是 1–3650,历史全部按分钟保存,而主题最宽只画 7 天、匿名接口最多给 168 小时:多存的天数看不到,代价却随天数线性增长。100 台节点、每台 4 个延迟监控保留 90 天,库有 1.63 GiB,每小时的清理持锁 25 秒,打开数据页 17 秒。
metric_hour/ping_hour,按保留天数清理。一小时结束后再等一小时才汇总(agent 最慢一小时上报一次,探测结果等下一帧才落库),分钟明细在所在的小时汇总之后才删cpu_max与minutes(有数据的分钟数),主题可以据此积分流量、画在线率/api/me返回history_daysping_hour的行(回退到旧版再升级时会有)测试
cargo fmt --check、cargo clippy --all-targets、cargo test(129 个)通过;面板 lint、test、build 通过cpu_max、minutes),并与造数据时独立算出的分钟数、峰值和各小时均值对照,最后一小时留在明细里测两层的拼接;去掉加权、去掉水位线之后的明细、中位数不加权、不等迟到余量,四种改法各自让用例失败;汇总之前的宽窗口只读最近一周的明细。旧版本导出的备份能恢复并补建汇总表scripts/e2e.sh配 agent v1.1.0 通过配套:主题 monitor-probe/monitor-theme-default#19、monitor-probe/monitor-theme-serverstatus#18;文档 monitor-probe/monitor-document#33