Skip to content

Fix tracing follow-ups: entity handler provider, DTS client converter precedence, lazy ack index - #204

Open
andystaples wants to merge 1 commit into
mainfrom
andystaples-tracing-post-merge-fixes
Open

andystaples wants to merge 1 commit into
mainfrom
andystaples-tracing-post-merge-fixes

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 82ebe8d634e1804007f11285826e82f4f6ac69af

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ New entity-handler and converter-precedence assertions fail without the fix and pass with it.
↑ 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.
Diagnosis confidence 9/10 ↑ trace.ContextWithSpanContext installs a span whose TracerProvider() is a no-op, which otelhttp uses when a valid parent exists.
↑ Caller options were appended after WithDataConverter(Options.DataConverter) while ScheduledTasks uses Options.DataConverter.
Evidence fit 8.5/10 ↑ Matches the post-merge review reproductions on #186, #189, and #192.
↓ 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 with trace.ContextWithSpanContext, whose span reports a no-op TracerProvider(). Instrumentation that discovers its tracer from the context, such as otelhttp without WithTracerProvider, 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. TestWorkerTracingEntityHandlerSpanContext now discovers the provider from the handler context.

DTS client data converter precedence (#186)

durabletaskscheduler.NewClient applied caller options after the DTS-owned settings, so client.WithDataConverter could change the converter for direct operations while ScheduledTasks still encoded with Options.DataConverter. Caller options are now applied first. Options.DataConverter always wins; Options.LargePayloads and Options.Versioning.DefaultVersion win when set.

Acknowledgement index cost (#189)

The orchestration trace built EventSent and 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)

  • "Without caller context" is now "without a propagated parent trace context", and the guide notes that the create_orchestration span is always propagated when client tracing is enabled.
  • "Purged or abandoned" is now "purged before it completes"; abandoned dispatches are already covered under Limitations.
  • Documents that entity handler contexts expose the worker's tracer provider.

Not changed

- 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]>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 17:32

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.

🟢 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

@berndverst Bernd Verst (berndverst) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Comment thread tracing/README.md
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

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.

3 participants