Add OpenTelemetry distributed tracing example for Azure Managed DTS#95
Merged
Add OpenTelemetry distributed tracing example for Azure Managed DTS#95
Conversation
- Add trace-helper functions to manage OpenTelemetry spans for orchestrations, activities, and timers. - Introduce methods to start spans for new orchestrations, orchestration executions, task scheduling, and event handling. - Implement span error handling and status management. - Create protobuf messages for orchestration trace context. - Add tests to validate tracing functionality, including span creation, attribute verification, and error handling.
…Durable Task Scheduler - Update environment variable names for connection strings in examples and tests - Introduce distributed tracing example with OpenTelemetry integration - Create Docker Compose setup for local testing with DTS Emulator and Jaeger - Update README files to reflect new configuration and usage instructions
…orker - Added structured logging capabilities to ConsoleLogger and NoOpLogger. - Implemented logEvent method in ConsoleLogger and NoOpLogger to handle structured log events. - Introduced emitLog utility to centralize logging logic for structured and non-structured loggers. - Created centralized log definitions for Durable Task Client and Worker, aligning with .NET SDK event IDs and message templates. - Added various logging functions for orchestration and activity lifecycle events in the worker. - Implemented error handling utilities for safe error message extraction. - Updated tests to cover new structured logging functionality and ensure proper logging behavior.
…CodeQL configuration
There was a problem hiding this comment.
Pull request overview
This PR adds OpenTelemetry distributed tracing support to the Durable Task JavaScript SDK for Azure Managed DTS. It enables end-to-end trace visualization across orchestration scheduling, execution, activities, sub-orchestrations, and timers through W3C Trace Context propagation.
Changes:
- Added comprehensive OpenTelemetry tracing infrastructure with optional peer dependency on
@opentelemetry/api - Introduced structured logging system with event IDs and categories matching .NET SDK conventions
- Renamed environment variable from
AZURE_DTS_CONNECTION_STRINGtoDURABLE_TASK_SCHEDULER_CONNECTION_STRINGacross examples and tests - Added distributed tracing example with DTS Emulator and Jaeger visualization setup
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/durabletask-js/src/tracing/* |
New tracing infrastructure including constants, trace context utilities, and helper functions for span creation |
packages/durabletask-js/src/worker/* |
Integration of tracing spans and structured logging into worker execution flow |
packages/durabletask-js/src/client/* |
Integration of tracing spans and structured logging into client operations |
packages/durabletask-js/src/types/logger.type.ts |
Added StructuredLogger interface and createLogEventHandler for structured logging |
packages/durabletask-js/src/utils/* |
New utility functions for error handling and log emission |
packages/durabletask-js/test/* |
Comprehensive test coverage for tracing and logging features |
examples/azure-managed/distributed-tracing.ts |
New example demonstrating OpenTelemetry tracing with Jaeger |
examples/azure-managed/docker-compose.yml |
Docker setup for DTS Emulator and Jaeger |
test/e2e-azuremanaged/*.spec.ts |
Updated E2E tests with new connection string environment variable |
packages/durabletask-js/package.json |
Added OpenTelemetry as optional peer dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
YunchuWang
reviewed
Feb 6, 2026
YunchuWang
reviewed
Feb 6, 2026
YunchuWang
reviewed
Feb 6, 2026
YunchuWang
reviewed
Feb 6, 2026
YunchuWang
reviewed
Feb 6, 2026
packages/durabletask-js/src/orchestration/enum/orchestration-status.enum.ts
Outdated
Show resolved
Hide resolved
YunchuWang
reviewed
Feb 6, 2026
…ationStatus and protobuf
YunchuWang
reviewed
Feb 6, 2026
YunchuWang
reviewed
Feb 6, 2026
…tivity and orchestration executors
YunchuWang
reviewed
Feb 6, 2026
YunchuWang
approved these changes
Feb 6, 2026
YunchuWang
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What changed?
distributed-tracing.tsexample inexamples/azure-managed/that demonstrates end-to-end OpenTelemetry distributed tracing with the Durable Task JavaScript SDKdocker-compose.ymlthat starts the DTS Emulator (mcr.microsoft.com/dts/emulator:latest) and Jaeger for local trace visualization.env.emulatorwith pre-configured connection string for the local emulatorREADME.mdwith step-by-step setup instructions for both emulator and cloud scenariosAZURE_DTS_CONNECTION_STRINGtoDURABLE_TASK_SCHEDULER_CONNECTION_STRINGacross examples and E2E testsTask<Promise<T>>vsTask<T>inindex.tsfan-out exampleWhy is this change needed?
Issues / work items
Project checklist
AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
distributed-tracing.ts,docker-compose.yml,.env.emulator,README.mdAI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
docker compose up -d— DTS Emulator + Jaeger startedcp .env.emulator .env— configured for local emulatornpm run example -- ./examples/azure-managed/distributed-tracing.ts— both orchestrations completeddurabletask-js-tracing-exampleNotes for reviewers
@opentelemetry/sdk-node, etc.) are not added topackage.json— they are installed ad-hoc withnpm install --no-saveas documented in the README, keeping the repo dependency footprint small.mcr.microsoft.com/dts/emulator:latestwithAuthentication=Nonefor local dev.