Repository navigation
Document and exercise enabled replay-aware tracing - #193
Conversation
e3a5f2a to
320dd7a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The tracing README incorrectly labels Python entity-operation spans as unimplemented and needs to distinguish Python’s SERVER signal spans from Go/Core’s CONSUMER spans.
1 open issue
What changed in this PR
Completes the replay-aware tracing stack with an enabled OTLP sample, end-to-end coverage, and documentation for application-owned telemetry. Tracing remains opt-in.
Changes:
- Enables client and worker tracing in the sample, with worker shutdown before provider flushing.
- Adds enabled-mode tests for span parentage, independent entity roots, and entity failures.
- Documents span lifecycles, sampling, SDK parity, and delivery limitations.
| File | Description |
|---|---|
tracing/tracing.go |
Adds a package-doc pointer to the tracing guide. |
tracing/README.md |
Adds enablement, span semantics, parity, and limitations guidance. |
tests/tracingtree/tracingtree.go |
Clarifies the default tracing behavior in comments. |
tests/durabletaskscheduler/dts_tracing_tree_test.go |
Updates comments describing disabled-mode assertions. |
tests/durabletaskscheduler/dts_tracing_enabled_test.go |
Adds enabled-mode span-tree and entity tracing coverage. |
samples/distributedtracing/README.md |
Documents enabled tracing and provider lifecycle. |
samples/distributedtracing/distributedtracing.go |
Enables tracing and verifies durable-span collector receipt. |
README.md |
Updates tracing guidance and provider configuration examples. |
Review effort: Balanced
320dd7a to
d76c179
Compare
d76c179 to
8bfb1bb
Compare
8bfb1bb to
687a6b9
Compare
687a6b9 to
924cbec
Compare
0eeb1f8 to
cd6e01a
Compare
Co-authored-by: Copilot App <[email protected]>
Document that DTS doesn't emit durable spans, logical versus execution-turn spans, and duplicate-source guidance. Add a durabletask-js column and the enablement, scope, root, export-timing, and status rows to the parity table, and correct the Python and JavaScript entity rows. Reconcile the changelog. Extend the enabled DTS E2E test with the Microsoft.DurableTask scope, unset success status, entity operation and integer task ID attributes, an activity failure, a continue-as-new generation pair, an application span under an entity operation, and a late-duplicate guard. The sample now uses a default resource, checks span kinds on receipt, and points readers at OTLP backends. Co-authored-by: Copilot App <[email protected]>
Clarified the behavior of sampling in orchestration and the use of different samplers. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
1dcd5bd to
6ea8927
Compare
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Post-merge review: The guide, enabled sample, and DTS end-to-end coverage meet the goal without changing the SDK API. The follow-ups below clarify parentage and abandonment and make the collector check verify the HTTP span chain it documents.
|
|
||
| Failures get an error status. Successful spans leave the status unset. | ||
|
|
||
| Without caller context, an orchestration becomes the root of a new trace. Its |
There was a problem hiding this comment.
Can we say “without a propagated parent trace context” rather than “without caller context” here and in the span/parity tables? With client tracing enabled, ScheduleNewOrchestration(context.Background(), …) starts a root create_orchestration PRODUCER, and the worker SERVER span is its child. This PR's receiver E2E already asserts that topology. The worker derives a new trace ID only when it receives no valid parent.
|
|
||
| - A running, suspended, or never-completing orchestration has no exported | ||
| orchestration span yet. Its exported children can appear under a parent that | ||
| your backend doesn't show until the orchestration completes. If the |
There was a problem hiding this comment.
Please distinguish an abandoned work-item dispatch from an execution that never completes. An abandoned dispatch can be redelivered, and the execution can still finish and export its logical span. I'd use “purged before completion” here and let the existing limitation say the abandoned dispatch exports nothing.
| if _, ok := found[name]; !ok { | ||
| missing = append(missing, name) | ||
| for _, want := range expected { | ||
| found := false |
There was a problem hiding this comment.
The collector check can pass with the expected names and kinds in the same trace even if the parentage is wrong or the HTTP CLIENT span is absent. Since the sample documents that HTTP chain, could we name the client span explicitly and verify activity SERVER → HTTP CLIENT → local_trace_target SERVER by span and parent ID?

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
687a6b96b470e66bfe52bd0b3a4939616724fdd7↑ Build, vet, sample-module tests, and golangci-lint v2.14.0 pass; CHANGELOG entries remain separate.
↑ Docs reflect propagation of unsampled caller context.
↓ OTLP collector export was not exercised end to end on this revision; race tests were not run.
Stacked on #192. Resolves #175.
Summary
Completes the opt-in, replay-aware tracing stack with documentation, an enabled-mode sample, and end-to-end coverage. Durable Task Scheduler persists and forwards trace context but doesn't emit durable orchestration, activity, timer, sub-orchestration, or entity spans, or export spans to an application's backend. SDK tracing is the supported way to get those spans into any OpenTelemetry-compatible backend, next to the application's own spans.
tracing/README.md,tracingpackage docs, root README):tracing.ErrUnsupportedTracerProvider), and shutdown order (worker, client, then provider).orchestration:<name>SERVER span per execution (per continue-as-new generation), from the first traced dispatch to completion. Dispatches and replays emit no span. A running, suspended, or never-completing orchestration has no exported orchestration span yet, so its exported children can appear under a parent that the backend doesn't show until completion.client.WithWorkerTracerProviderandclient.WithTracerProviderkeeps the SDK silent. SDK spans use theMicrosoft.DurableTaskscope and the provider's resource.samples/distributedtracing): passes one provider toclient.WithWorkerTracerProviderandclient.WithTracerProvider, builds the resource withresource.New(service name, environment, telemetry SDK), and exports over OTLP/HTTP to a collector. It verifies that the collector received the caller, create-orchestration, orchestration, activity CLIENT and SERVER, timer, and application HTTP spans with their expected kinds. The README explains how to forward the collector to Jaeger, Azure Monitor, or another OTLP backend.tests/durabletaskscheduler/dts_tracing_enabled_test.go): uses an explicit provider and an in-memory exporter, without changing the global provider, and asserts the exact exported span set, with a guard against late duplicates:create_orchestrationPRODUCER →orchestrationSERVER → sub-orchestration and activity CLIENT/SERVER; timer INTERNAL; clientRaiseEventand orchestratorSendEventPRODUCER spans. All SDK spans use theMicrosoft.DurableTaskscope.durabletask.task.status=Failedon the SERVER span, and the calling orchestration's instance ID and an integer task ID.durabletask.task.operationanddurabletask.entity.operation, and successful operations leave the status unset. An application span started fromEntityContext.Context()nests under its operation span. ClientSignalEntityemits no span.dts_tracing_tree_test.gostill assert propagation without SDK spans.Parity
ActivitySource(needs a listener)emit_trace_spans=False@opentelemetry/apiMicrosoft.DurableTaskMicrosoft.DurableTaskdurabletaskMicrosoft.DurableTaskcall_entity/signal_entity, clientsignal_entity,entity:lock_requestActivity and sub-orchestration CLIENT/SERVER spans, timer INTERNAL spans, and create-orchestration, raise-event, and send-event PRODUCER spans exist in all four SDKs. No SDK emits an event-receipt CONSUMER span.
Limitations
SignalEntityemits no span and propagates only a sampled caller context, like the .NET gRPC SDK.The DTS tests run in PR validation through
DTS_EMULATOR_ENDPOINTand skip when no DTS target is configured. Tracing stays opt-in.