feat: log and report slot growth triggers - #124
Merged
Conversation
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.
背景
传输层懒加载扩容(grow)此前无任何观测手段:
OpenRequest不带目标信息,grow()无日志,导致无法回答"是哪类请求(协议、目标 IP:端口)触发了槽位扩容"。用户曾在统计页面观察到 bulk 池槽数在两次刷新间从 2 涨到 9(默认配置下 bulk 池上限恰为 9),需要定位触发请求。改动
transport.OpenRequest新增Target字段(仅用于观测,不参与调度),由 proxy 层openAndBootstrap全量传入(TCP/UDP/ICMP);grow()返回实际扩容的池子与扩容后 live 槽数(nil 表示未扩容),并发写锁串行化保证归因精确到真正触发扩容的请求;Open在触发扩容时打印[TRANSPORT] slot grown日志(pool/live/endpoint/proto/target);TransportStats新增recent_grow_events(最近 16 条扩容事件环形缓冲,新→旧,含时间/池子/槽数/endpoint/目标);stats新增slot_grown_priority/slot_grown_bulk累计计数,并加入 30s 周期的[STATS]日志。验证
go test -race ./transport/... ./client/...通过;make lint0 issues;go test ./...仅util包TestIsTunIface失败,属环境既有问题(本机存在 easyss TUN 接口 utun9,已在干净树上复现,与本次改动无关)。使用方式
复现扩容场景后查看客户端日志中的
[TRANSPORT] slot grown行,或刷新统计页面查看recent_grow_events与slot_grown_*计数。