microsoft / microsoft/durabletask-dotnet

Entity operations don't propagate trace context from parent orchestration

Đang mở
#653 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Triage :mag:
Ngôn ngữ chính
C#
Star
193
Fork
60
Merge trung bình
3 ngày 12 giờ
Pull request đã merge (30 ngày)
4

Mô tả

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)
  • SendEntityMessageActionno 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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong src/Shared/Grpc/ProtoUtils.cs và so sánh SendEntityMessageAction với ScheduleTaskAction và CreateSubOrchestrationAction, nơi ParentTraceContext đã được tạo. Sau đó, lần theo đường dẫn xử lý work item của entity để xem context được phân tích cú pháp và khôi phục như thế nào. Hoàn thành khi các span của entity và các span con được đặt dưới trace của orchestration gọi chúng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, grpc
Lĩnh vực
distributed-systems, observability-sre
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.