Skip to content

Expand OpenTelemetry tracing test coverage for Azure Storage - #1400

Open
Varshitha Bachu (bachuv) wants to merge 1 commit into
mainfrom
vabachu/native-otel-context
Open

Expand OpenTelemetry tracing test coverage for Azure Storage#1400
Varshitha Bachu (bachuv) wants to merge 1 commit into
mainfrom
vabachu/native-otel-context

Conversation

@bachuv

Copy link
Copy Markdown
Contributor

Summary

Adds Azure Storage integration tests for OpenTelemetry context propagation across persistence, activity retries, and sub-orchestrations.

These tests protect the Durable Task tracing behavior required by language SDKs that activate the runtime-provided trace context. Production code is unchanged.

Details

  • Verifies a foreign W3C parent and tracestate survive storage persistence and a task-hub service restart.
  • Verifies the orchestration server span is parented by the incoming foreign span.
  • Verifies scheduled activity client spans and activity execution server spans form the expected parent chain.
  • Verifies each activity retry creates distinct client and server spans.
  • Verifies failed retry attempts are marked as errors without changing the trace ID.
  • Verifies sub-orchestration client and server spans are linked correctly.
  • Verifies parent and child orchestration instance IDs are represented on the appropriate spans.
  • Ensures workers and task-hub services are stopped and deleted during cleanup.

Validation

The following tests pass against dedicated Docker Azurite storage:

  • OpenTelemetry_ForeignParentSurvivesStorageRestart
  • OpenTelemetry_ActivityRetryCreatesDistinctAttemptSpans
  • OpenTelemetry_SubOrchestrationLinksClientAndServerSpans

Copilot AI lite review requested due to automatic review settings September 10, 2026 15:50

protected override string Execute(TaskContext context, string input)
{
if (Interlocked.Increment(ref attemptCount) == 1)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new restart test’s cleanup is not guaranteed if CreateAsync() throws and it doesn’t dispose IDisposable service/worker instances, which can lead to leaked resources and test flakiness over time.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds new Azure Storage integration tests to validate OpenTelemetry trace-context propagation and span parenting behavior across service restarts, activity retries, and sub-orchestrations (no production code changes).

Changes:

  • Add a restart-focused test that injects a foreign W3C traceparent/tracestate and validates it survives persistence and hub restart.
  • Add retry-focused test coverage to ensure each activity retry attempt produces distinct spans and error status is applied correctly.
  • Add sub-orchestration span-linking assertions to validate expected parent/child span relationships and instance-id tagging.
File summaries
File Description
test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs Adds three OpenTelemetry-focused Azure Storage integration tests plus small helper utilities and new orchestration/activity test types.
Review details

Suppressed comments (1)

test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs:4229

  • AzureStorageOrchestrationService implements IDisposable, but neither the pre-restart nor post-restart service instances are disposed. Disposing both service objects in the finally block reduces resource leakage (e.g., session manager resources) across the test suite.
                if (serviceAfterRestart != null)
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4146 to +4149
await serviceBeforeRestart.CreateAsync();

try
{
Comment on lines +4224 to +4228
if (worker != null)
{
await worker.StopAsync();
}

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.

2 participants