Repository navigation
feat(health): add on-demand node health snapshot RPC with 10s local cache - #276
Merged
Merged
Conversation
uvwt
force-pushed
the
feat/node-health-snapshot
branch
from
November 30, 2026 17:05
1120639 to
313d887
Compare
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.
Summary
新增按需宿主机健康快照采集能力,复用既有
runtime.request链路提供轻量、零破坏性的健康状态查询。零破坏性契约
runtime.request新增GET /internal/runtime/health(支持?force=true跳过缓存强制采样),同时注册至本地 Runtime HTTP API(timeout类别错误映射为504 Gateway Timeout)。runtimeapi.HealthRuntime扩展,不改动既有心跳保活与协议握手;未实现该接口时返回结构化错误HEALTH_UNSUPPORTED。os、cpu_percent、memory、disk、uptime_seconds、load、collected_at、cached),失败或超时返回HEALTH_TIMEOUT/HEALTH_COLLECTION_FAILED供控制面与前端优雅降级。缓存、并发控制与三平台零 CGO 采集
singleflight防击穿 + 2s 采样硬超时:防止高频或并发查询放大宿主机采集开销,避免慢采样拖垮请求链路。internal/health/collect_linux.go)internal/health/collect_darwin.go)internal/health/collect_windows.go)internal/health/collect_other.go) 与通用解析逻辑 (internal/health/parse.go)验证
internal/health/collector_test.go:缓存命中/过期、force 刷新、singleflight 合并、2s 超时与三平台解析测试。internal/runtimeapi/dispatch_test.go&internal/nexusbridge/client_test.go:GET /internal/runtime/health路由分发及 Nexus Bridge RPC 链路测试。