Repository navigation
fix: agent 上报按自身节奏限速,流量与探测结果约每分钟落库一次 - #59
Merged
Merged
Conversation
- hub 保留每个节点最新读数,跨分钟或断点时记账,会话结束与退出时补记 - 读数按到达时间归日、归账期,不回记已离开的周期 - 探测结果按分钟批量写入 - 每条连接的上报、hello、探测结果按 agent 自身节奏封顶 - 容量随 last_seen 写入;面板 metrics 也走白名单,四个流量字段由 hub 填入
- 重连顶替半开连接时,旧连接攒下的探测结果照样写入;面板结束的连接仍不写 - 墙上钟往回校正后不再沿用校正前留下的未来日期,日、月计数回到今天 - 写入上一分钟的探测结果失败时只记日志,不丢弃触发它的那一帧
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.
hub 收 agent 上报的一侧:每条连接按 agent 自己的节奏封顶,流量与探测结果改为约每分钟落库一次。agent 与协议不变。
写入量
流量行原来每条上报提交一次,每次提交至少写一页。8 个节点每秒上报的 hub,7.3 小时写盘 1.04 GB,库只有 8 MB。
每条连接的上限
节点 token 能以任意速率发帧,每帧都解析、多数都写库:不设限时单连接 10 秒 34,209 条上报,写盘 93 MB。现在超出 agent 自身节奏的部分丢弃:
同样的洪泛改后写盘 16 KB。上限随连接重置,泄露的 token 反复重连时每次握手仍是两次提交;正常 agent 不会这样重连,代码里已标注上限与升级办法(按节点给握手限频),在那之前换发凭证即可止住。
其它
node的内存、交换、磁盘容量随last_seen一起写入,节点离线后显示的是最后一次上报的值,不再是连接时的值metrics也走白名单,只比公开页多iface;boot_id与原始计数器不再下发metrics里的total_rx/total_tx/month_rx/month_tx由node_view从流量行填入,与顶层同值(两个官方主题都依赖这四个字段)boot_id或计数器的上报不产生读数,流量行保持原样Db上的常量,接口校验与限流共用测试
cargo fmt --check、cargo clippy --all-targets、cargo test(121 个)通过