Commit Graph

8 Commits

Author SHA1 Message Date
Lyon 7fc4844b9d fix: instrument slow readiness routes (#1896) 2026-06-22 15:06:51 +08:00
Lyon 0f3bc3f99a fix workbench otel http span timing (#1815) 2026-06-21 12:07:37 +08:00
Lyon fb1fe8d94a feat(otel): 服务端 HTTP request span 追穿 hwlab-cloud-api 503 (#1764)
问题:hwlab-cloud-api 服务端 503(如 workbench 投影存储不可用)在 Tempo
里只有 workbench-ui 浏览器侧 span,没有服务端 request handler span,导致
后端根因(error.code=projection_store_unavailable 等)只能在应用日志里看,
OTel 链路追不到服务端处理层。

修复:
- otel-trace.ts 新增 emitHttpServerRequestSpan(scope hwlab.http.server,
  SPAN_KIND_SERVER),捕获 http.route/method/status_code/status_class、
  request.id,5xx 时落 STATUS_CODE_ERROR 并把 error.code/category/layer
  写入 span 属性与 status.message。
- error-envelope.ts 的 decorateErrorPayloadForHttp 把诊断 error code/
  category/layer 回写到 hwlabHttpRequestContext.lastHttpError,供 finish
  时复用,避免重复解析。
- server.ts 在 response finish 时按 http context + backend performance
  时序发服务端 span;health/metrics 探针路由跳过,避免 OTel 噪声洪泛。

验收:canary 调用 emitHttpServerRequestSpan 发 503 projection_store_unavailable
span 到 D601 platform-infra OTel collector,Tempo 可查到 service=hwlab-cloud-api、
scope=hwlab.http.server、http.response.status_code=503、error.code=
projection_store_unavailable 的 ERROR span。
2026-06-20 20:31:36 +08:00
lyon efafeccfb9 feat: attach cloud api otel trace headers 2026-06-20 14:54:51 +08:00
lyon 786569eac0 fix: trace auth login with otel 2026-06-20 08:37:56 +08:00
lyon 4eadd2f85a fix: trace workbench loading states with otel 2026-06-20 00:47:57 +08:00
lyon c2629c5ebf fix: improve code agent trace visibility 2026-06-20 00:04:23 +08:00
lyon 69b8e03661 feat: add code agent otel spans 2026-06-19 23:05:50 +08:00