feat: obs-sdk 实现 #2061(spec 契约 + Go/Python/Java/Node SDK + UT) - #1
Conversation
…注入/trace_id 预留) Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
…nit,CI 编译验证) Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Welcome To opensourceways CommunityHey @TangJia025 , thanks for your contribution to the community. Bot Usage ManualI'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. |
CLA Signature PassTangJia025, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
Linking Issue Notice@TangJia025 , the pull request must be linked to at least one issue. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
python: - starlette.testclient(FastAPI 中间件单测)需要传输依赖 httpx2, CI 只装了 fastapi/flask/django/pytest,缺依赖时 testclient 直接 RuntimeError。CI 增加 httpx2>=2.0.0,并在 pyproject test extra 同步声明。 本地 A/B 验证:移除 httpx/httpx2 → 1 failed;装 httpx2 → 14 passed。 java: - ObsMetrics 用了 java.util.concurrent.atomic.AtomicDouble,该类不存在于 JDK(是 Guava 的)。改用 AtomicReference<Double>,保留默认值 0.0 与 「注册时建可写状态」语义。 - RequestContext 静态 requestId()/traceId() 与实例方法重名(Java 不允许 同名同参),静态两个改名为 currentRequestId()/currentTraceId(),与既有 communityOverride() 命名对齐;同步更新 RequestContextTest 调用点。 该重名同时导致 ObsLogging 的 Optional 三元表达式报「incompatible types」 级联错误,改名后一并消除。 .gitignore 补 target/(maven 构建产物)。 本地四语言验证:Go ok / Python 14 passed / Node 9 pass / Java BUILD SUCCESS(8 tests)。
CLA Signature PassTangJia025, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
resolve https://github.com/opensourceways/backlog/issues/2061
背景
opensourceways/backlog#1938 微服务可观测建设 · 子任务 A opensourceways/backlog#2061:obs-sdk 单仓建设。
按 #2061 验收:spec 契约层 + Go / Python / Java / Node 4 语言 SDK package + UT(试点服务接入与 robot-framework-lib 切换属下游各仓改动,不在此 PR)。
交付内容
spec/OBS_*环境变量)、指标命名/label(metrics-format)、community 取值(community-values)go/go vet+go test通过python/node/java/.github/workflows/ci.yml关键设计对齐点
service/env/instance部署级 const;community普通可变 label/字段 —— 请求级在服务可信判定点(路由前缀/认证主体/白名单)解析后写请求上下文,未覆盖回退部署默认(OBS_COMMUNITY)。(Go context / Python contextvars / Node AsyncLocalStorage / Java ThreadLocal)obs_http_server_*;Java 走 Actuator + Micrometer 官方 server instrumentation,不重复埋点(starter 对齐)。测试结果(本机)
cd go && go vet ./... && go test ./...→ 全过cd python && ./.venv/bin/python -m pytest -q→ 14 passedcd node && npm test→ 9 passedmvn test;若 CI 暴露问题以其输出为准修复。🤖 Generated with Claude Code
AI 使用声明
当前 PR 是否有 AI 参与: