Repository navigation
feat(logging): 接入 litheLogging 1 结构化诊断 - #3
Merged
Merged
Conversation
- Rust SDK 改为仓库内 vendor 副本(基线 lithe-plugin-docs 29b245c 加本轮日志改动), scripts/verify-sdk-source.mjs 按逐文件 SHA-256 校验,CI 与打包都会先跑 - 列表、日志、统计、事件轮询、文件浏览与分块上传等高频成功不再记 INFO - 引擎连接状态按变化去重:不可达只报一次 WARN(按 context_not_found / unsupported_host / permission_denied / connection_lost / unreachable 分类), 恢复后报一次 recovered - 自动拉取缺失镜像后创建成功、compose 下线时网络仍被占用,各记一次 WARN - 启动失败不再向 stderr 打印 - e2e 改为显式 --source/--ref,CI 指向宿主 preview,并断言每次调用恰好一条 类型化终态事实(通道、级别、operation)
This was referenced Nov 4, 2026
xiaoyumuxi
marked this pull request as ready for review
November 4, 2026 10:52
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.
概要
Docker 插件后端接入结构化日志 v2:改用支持
litheLogging1 的官方 Rust SDK,由 SDK 自动上报用户动作和传输的成功/失败终态;列表、日志、统计、事件轮询等高频调用不再产生 INFO;引擎连接状态的变化、缺失镜像自动拉取、compose 下线时网络仍被占用,改为类型化的降级/恢复事实。诊断事实由宿主 Core 写入plugins/<id>/host,不含端点地址、容器内容或日志正文。依赖:
litheLogging协议、目录事件、lithe/log校验)SDK 来源:从 git tag 改为 vendor 源码快照
backend/Cargo.toml的lithe-plugin-sdk从 tagsdk-rust-v0.1.0(e689971)改为path = "../vendor/lithe-plugin-sdk";backend/Cargo.lock只删除了对应的 git source 行。vendor/lithe-plugin-sdk/(Apache-2.0)。基线是 lithe-plugin-docs29b245c0e1d77c761d9032a3144a301d1818bfc7,加上 SDK PR #17 的日志改动;source-provenance.json记录基线、本地改动和逐文件 SHA-256。scripts/verify-sdk-source.mjs逐文件校验来源;CI 新增 “Verify SDK source provenance”,scripts/package.mjs打包前也会先跑。诊断行为(
backend/src/service.rs)containers.list、containers.logs、containers.stats、containers.top、contexts.list、engine.info、events.next、images.list、images.logo、networks.list、objects.inspect、system.df、volumes.list、files.list、files.uploadBegin、files.uploadChunk。AtomicU8保存,按状态变化去重:engine.info把“不可达”作为降级的成功结果返回(SDK 不会记失败),状态变化时上报一次degraded("engine.info", code)。code按错误分类:context_not_found、unsupported_host、permission_denied、connection_lost,其余为unreachable。UI 反复探测同一状态不会重复上报。recovered("engine.info", "connection_restored");正常连通的探测保持静默。containers.create自动拉取缺失镜像后创建成功,上报recovered("containers.create", "missing_image_pulled")。compose.action下线时有网络因docker.conflict仍被占用而保留,上报degraded("compose.action", "networks_in_use", count)。main.rs:listen之前的启动失败不再eprintln!,以退出码结束,由宿主进程生命周期记录。端到端测试与 CI
scripts/e2e.mjs必须显式传--source和--ref(新 SDK 要求 Core 支持litheLogging1)。e2e/docker_plugin.rs:除上面列出的高频调用外,每次调用(以及所有失败调用)都断言恰好一条类型化终态事实,并核对通道、级别(成功 INFO,失败 ERROR)、operation和 op 关联。.github/workflows/ci.yml与release.yml的 e2e 改为--source https://github.com/1lck/Lithe-IDEA.git --ref preview。验证
backend/目录,与 CI 一致):cargo fmt --all -- --check、cargo clippy --locked --all-targets -- -D warnings通过;cargo test --locked27 项通过;node scripts/verify-sdk-source.mjs通过。预期的 CI 状态与合并顺序
preview之前,CI 和 release 的 e2e 会因 Core 不支持litheLogging1 而失败,这是预期结果。contract/v1)→ 本 PR。发布前把 vendor 的 SDK 重新固定到 SDK #17 合并后的 commit。限制
配套 PR: