Repository navigation
Fix tracing follow-ups: entity handler provider, DTS client converter precedence, lazy ack index - #204
Fix tracing follow-ups: entity handler provider, DTS client converter precedence, lazy ack index#204andystaples wants to merge 1 commit into
Conversation
- Entity handler contexts expose the worker tracer provider, so context-discovered instrumentation such as otelhttp records children. - DTS NewClient applies Options-owned converter, large payload, and default version settings after caller options so ScheduledTasks and direct operations encode payloads the same way. - Build send and entity-signal acknowledgement indexes only when a replayed send or signal needs them. - Clarify trace parentage and purge wording in the tracing guide. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the tracing, client-option precedence, and acknowledgement-index changes.
No open issues 🎉
What changed in this PR
Addresses follow-ups to the Go SDK’s replay-aware tracing work: enables context-discovered instrumentation in entity handlers, makes Durable Task Scheduler client option precedence consistent, and reduces acknowledgement-index work.
Changes:
- Exposes the worker’s tracer provider through non-recording entity operation spans, with regression coverage and documentation.
- Makes scheduler-owned converter settings—and large-payload and default-version settings when set—override trailing client options.
- Builds acknowledgement indexes only when replayed sends or signals remaining in a response require them.
| File | Description |
|---|---|
tracing/README.md |
Clarifies parent-context propagation, entity provider discovery, and span export behavior. |
task/executor.go |
Installs reserved entity spans in handler contexts. |
internal/dttrace/entity.go |
Adds provider-aware reserved spans and defers signal acknowledgement lookup. |
internal/dttrace/dttrace.go |
Retains the tracer provider and lazily builds acknowledgement indexes. |
durabletaskscheduler/client.go |
Enforces scheduler-owned option precedence. |
durabletaskscheduler/client_tracing_test.go |
Tests converter and default-version precedence over conflicting client options. |
client/grpc_worker_tracing_test.go |
Tests entity child spans using the provider discovered from handler context. |
Review effort: Balanced
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
The entity-handler provider and DTS converter precedence fixes look good. I would hold approval until we address the replayed entity-signal allocation regression below. The tracing guide also needs a small qualification.
| o.entitySignals = make(map[int32]entitySignal) | ||
| } | ||
| recorded := entitySignal{id: id, signal: signal, replaying: replaying} | ||
| recorded := entitySignal{id: id, signal: signal, key: key, replaying: replaying} |
There was a problem hiding this comment.
This now stores a full record for every replayed entity signal until replay consumes its ack. Previously, signals with an ack already in the request skipped this record. In an isolated tracing benchmark with 10,000 fully acknowledged signals, replay rose from 2.6 to 4.2 ms and from 1.31 to 3.67 MB per dispatch. Can we keep the cheaper event-send path without paying for a full record per replayed entity signal, for example by tracking only the minimal replay state until an action survives into the response?
| Without a propagated parent trace context, an orchestration becomes the root of | ||
| a new trace. Its trace ID is derived from the orchestration's persisted | ||
| identity, not from the base ID generator. With client tracing enabled, the | ||
| `create_orchestration` span is always propagated as the parent, even when the |
There was a problem hiding this comment.
Could we replace always with when the provider returns a valid span context? The client accepts a no-op provider; with no active caller span, that provider returns no valid context and the request has no trace parent.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
82ebe8d634e1804007f11285826e82f4f6ac69af↑ Existing dttrace, task, client, and durabletaskscheduler tests pass; golangci-lint is clean.
↓ Race tests and DTS emulator E2E not run locally; pending CI.
↓ Lazy acknowledgement index relies on existing tests for semantics; no new benchmark included.
trace.ContextWithSpanContextinstalls a span whoseTracerProvider()is a no-op, which otelhttp uses when a valid parent exists.↑ Caller options were appended after
WithDataConverter(Options.DataConverter)whileScheduledTasksusesOptions.DataConverter.↓ The otelhttp reproduction itself was not re-run; the test simulates provider discovery from context.
Follow-ups from post-merge reviews of #186, #189, #192, and #193.
Entity handler spans with context-discovered instrumentation (#192)
EntityContext.Context()installed the reserved operation span withtrace.ContextWithSpanContext, whose span reports a no-opTracerProvider(). Instrumentation that discovers its tracer from the context, such asotelhttpwithoutWithTracerProvider, therefore recorded nothing when tracing was enabled. The reserved span now reports the worker's tracer provider while remaining non-recording, so such instrumentation records children of the entity operation span.TestWorkerTracingEntityHandlerSpanContextnow discovers the provider from the handler context.DTS client data converter precedence (#186)
durabletaskscheduler.NewClientapplied caller options after the DTS-owned settings, soclient.WithDataConvertercould change the converter for direct operations whileScheduledTasksstill encoded withOptions.DataConverter. Caller options are now applied first.Options.DataConverteralways wins;Options.LargePayloadsandOptions.Versioning.DefaultVersionwin when set.Acknowledgement index cost (#189)
The orchestration trace built
EventSentand entity-signal acknowledgement maps from the full history on every traced dispatch. They are now built only when a send or signal created during replay is still in the response, which is the only case that consults them. Semantics are unchanged.Tracing guide wording (#193)
create_orchestrationspan is always propagated when client tracing is enabled.Not changed
create_orchestrationspan, so Go is consistent with them.