microsoft / microsoft/durabletask-dotnet
Entity operations don't propagate trace context from parent orchestration
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 193
- フォーク
- 60
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/Shared/Grpc/ProtoUtils.cs から始め、ParentTraceContext がすでに作成されている SendEntityMessageAction、ScheduleTaskAction、CreateSubOrchestrationAction を比較します。次に、コンテキストがどのように解析され、復元されるかを確認するため、エンティティ作業項目の処理経路を追跡します。エンティティの span と子 span が呼び出し元のオーケストレーション trace の下に親子付けされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, grpc
- 領域
- distributed-systems, observability-sre
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100