Skip to content

Add distributed tracing using opentelemetry#119

Draft
andystaples wants to merge 8 commits intomicrosoft:mainfrom
andystaples:andystaples/add-distributed-tracing
Draft

Add distributed tracing using opentelemetry#119
andystaples wants to merge 8 commits intomicrosoft:mainfrom
andystaples:andystaples/add-distributed-tracing

Conversation

@andystaples
Copy link
Contributor

@andystaples andystaples commented Mar 3, 2026

Adds support for Distributed Tracing by passing the trace information for orchestrations passed in the gRPC spec to activitites/entities/sub-orchestrations

Compare to the Dotnet SDK: https://github.com/microsoft/durabletask-dotnet

Jaeger profile for fan-out orchestration:
image

DTS view of the same orchestration:
image

Resolves #97

@andystaples andystaples marked this pull request as ready for review March 3, 2026 19:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OpenTelemetry-based distributed tracing to the Durable Task Python SDK by propagating W3C trace context through the gRPC protocol and emitting spans for orchestration, activity, sub-orchestration, timer, entity, and event operations.

Changes:

  • Introduces durabletask.internal.tracing with optional OpenTelemetry helpers for context extraction/injection and span lifecycle management.
  • Updates worker + client code paths to propagate TraceContext over gRPC and to create/finish spans across multi-dispatch orchestration replays.
  • Adds a comprehensive tracing test suite and updates dependency metadata to include OpenTelemetry packages/extras.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/durabletask/test_tracing.py New unit/integration-style tests covering tracing utilities and replay/lifecycle behavior
durabletask/internal/tracing.py New tracing utility module (optional OpenTelemetry dependency)
durabletask/worker.py Server-side span creation/propagation; persists orchestration + client spans across dispatches
durabletask/client.py Producer spans + parent trace context injection for orchestration creation and entity signals
durabletask/internal/helpers.py Adds parent_trace_context to schedule/sub-orchestration action helpers
pyproject.toml Adds opentelemetry optional dependency extra
requirements.txt Adds OpenTelemetry packages to the dev/test requirements list
CHANGELOG.md Notes improved distributed tracing support

You can also share your feedback on Copilot code review. Take the survey.

@andystaples andystaples marked this pull request as draft March 4, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Distributed Tracing

2 participants