microsoft / microsoft/durabletask-dotnet
Entity operations don't propagate trace context from parent orchestration
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 193
- 派生
- 60
- 平均合并
- 3 天 12 小时
- 30 天内合并 PR
- 4
描述
Summary
When an orchestration calls an entity via CallEntityAsync(), the DTS SDK does not propagate the orchestration's trace context (ParentTraceContext) to the entity operation. This causes entity spans (and any child spans created within the entity) to appear as disconnected root traces instead of being parented under the calling orchestration's trace tree.
Root Cause
In ProtoUtils.ConstructOrchestratorResponse, ParentTraceContext = CreateTraceContext() is set for:
- ✅
ScheduleTaskAction(activities) - ✅
CreateSubOrchestrationAction(sub-orchestrations) - ❌
SendEntityMessageAction— no trace context is set
This means the W3C traceparent / tracestate that enables distributed trace stitching is never included in entity messages dispatched from orchestrations.
Expected Behavior
Entity operations dispatched from an orchestration should inherit the orchestration's trace context, just like activities and sub-orchestrations do. The invoke_agent spans (or any other work done inside the entity) should appear as children of the orchestration span in a trace viewer.
Actual Behavior
Entity operations start a new, independent trace. In a trace viewer (e.g., Aspire Dashboard, Jaeger), entity spans appear as separate root traces with no parent relationship to the orchestration that dispatched them.
Impact
This is particularly impactful for scenarios that use Durable Entities as the execution model for agent invocations (e.g., DurableAIAgent in the Microsoft Agent Framework). Each invoke_agent span appears disconnected from the orchestration trace, making it impossible to view the full execution tree in a single trace.
Suggested Fix
In ProtoUtils.cs, add ParentTraceContext = CreateTraceContext() to the SendEntityMessage action construction (similar to how it's done for ScheduleTask and CreateSubOrchestration). The entity work item processing path would also need to parse and restore this context when executing entity operations.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 src/Shared/Grpc/ProtoUtils.cs 开始,对比 SendEntityMessageAction、ScheduleTaskAction 和 CreateSubOrchestrationAction,此时 ParentTraceContext 已经创建。然后跟踪实体 work item 的处理路径,查看 context 是如何解析和恢复的。当实体 spans 和子 spans 都以调用方 orchestration trace 作为父级时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, grpc
- 领域
- distributed-systems, observability-sre
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100