dodjdnh opened a new issue, #3831:
URL: https://github.com/apache/dubbo-go/issues/3831
## Problem
目前 `otelClientFilter` 通过 `reference.filter` 挂载在 `ProtocolFilterWrapper`
中,运行在 `ClusterInvoker` 内部、针对单次节点尝试(attempt)生效,而不是在每次逻辑 Consumer RPC
调用外层执行。这带来了三个可观测性缺口:
- **重试链路碎片化**:一次逻辑调用触发 `failover` 重试时,会产生多条平级且互不关联的 Client Span,缺少父级逻辑 Span
展示端到端总耗时与重试关联关系。
- **集群层失败丢失**:在进入节点调用前的失败(如路由过滤为空,或 `CheckInvokers` 判定无可用
Provider)会直接从集群层返回,无法到达 `otelClientFilter`,导致 Trace 记录完全缺失。
- **错误诊断过于粗糙**:当前 OTel Trace Filter 的错误路径仅调用 `span.SetStatus(codes.Error,
...)`,缺少 `span.RecordError(err)` 记录,也未携带与 `common/rpcerror` 和 `metrics/rpc`
对齐的错误分类属性。
## Expected Behavior
- **Actual**: 重试产生孤立的同级 Span;Filter 之前的集群层失败无 Trace 记录;失败 Span 缺少
`RecordError` 与统一错误分类。
- **Expected**:
- 每次 Consumer RPC 创建一个父级逻辑 Span,包裹 `otelClientFilter` 创建的所有子级尝试 Span(`1
个逻辑 Span -> 1..N 个尝试 Span`),准确反映包含选址与重试在内的端到端总耗时。
- 在发起节点调用前的集群层失败(如无可用 Provider)也能被逻辑 Span 捕获。
- 在 `failover` 路径记录低基数的集群诊断事件/属性,覆盖路由/负载均衡选址结果与重试原因,不泄露敏感载荷。
- 失败 Span 调用 `span.RecordError(err)`,并记录与 `common/rpcerror` /
`metrics/rpc` 一致的稳定错误分类(不靠错误字符串猜测)。
- 在同步返回、超时、Context 取消以及异步/并发集群路径下,逻辑 Span 均精确 `End()` 一次;关闭 Tracing
时保持零额外开销。
## Proposed Solution
- 新增 Consumer 侧 OTel `ClusterInterceptor`(开启 Tracing 时自动装配),围绕
`ClusterInvoker.Invoke` 管理逻辑 Span 生命周期;保持现有 `otelClientFilter` 的 Span
命名不变,避免破坏兼容性。
- 当 `context.Context` 中存在激活的逻辑 Span 时,由 `BaseClusterInvoker` /
`failoverClusterInvoker` 发出低基数的选址、重试与无节点诊断事件。
## Related Issues / PRs
- Related to #3562(可观测性 EPIC 主线)
- Related to #3338(Trace 子任务,此前已讨论调度决策位于当前 OTel Filter 之上的问题)
- Related to #3551(Span 命名与属性标准化 Draft PR,本方案保持增量不冲突)
- Related to #3784(已合入的 `common/rpcerror` 与错误分类实现,后续错误语义复用该底座;对应 Issue #3774)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]