Repository navigation
Trace orchestration event sends (replay-aware PRODUCER spans) - #189
Conversation
0ca9657 to
cc5edf3
Compare
8af3ddf to
6506b55
Compare
6506b55 to
b9203dc
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Replay suppression relies on DTS deduplicating reissued SendEvent actions when turn limits leave acknowledgements unconsumed, but the fake backend assumes this behavior and service-level validation is still needed.
No open issues 🎉
What changed in this PR
Extends opt-in worker tracing with replay-aware OrchestrationContext.SendEvent PRODUCER spans, building on client tracing toward broader orchestration lifecycle visibility.
Changes:
- Adds event-send spans under the sending orchestration, exported after response acceptance with replay and acknowledgement suppression.
- Adds tests for span parentage, replay, turn budgets, suspension, sampling, continue-as-new, and rejected or discarded sends.
- Documents best-effort export and the protocol limitation that prevents correlated event-receipt spans.
| File | Description |
|---|---|
tracing/tracing.go |
Documents event-send span semantics and receipt limitations. |
task/orchestrator.go |
Records sends and confirms validated history acknowledgements. |
internal/dttrace/dttrace.go |
Tracks send spans and exports them with accepted responses. |
client/grpc_worker_tracing_test.go |
Adds event-tracing coverage across replay and completion scenarios. |
client/grpc_worker_test.go |
Allows the fake scheduler to reject orchestration completions. |
CHANGELOG.md |
Announces opt-in orchestration event-send tracing. |
Review effort: Balanced
b9203dc to
f1b0b8c
Compare
|
On the review overview's point about reissued The Durable Task Scheduler commits The acknowledgement-based suppression is defensive. It covers backends that deliver |
f1b0b8c to
1efe9b9
Compare
1efe9b9 to
efff3ea
Compare
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Document the send span decision table, stamp fallback send spans when the response is prepared, make repeated Emit and late RecordSendEvent calls safe, cover rejected completions and same-turn continue-as-new, and add a changelog entry. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
efff3ea to
d51cdfc
Compare
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Post-merge review: The normal DTS path emits the producer span after the response is accepted and leaves the wire format unchanged. Two follow-ups: bound the per-dispatch history index, and cover a first send released by resume when its acknowledgement is in the same dispatch.
| if event.GetEventSent() != nil { | ||
| if o.acceptedSends == nil { | ||
| o.acceptedSends = make(map[int32]struct{}) | ||
| } |
There was a problem hiding this comment.
This rebuilds a map from all historical EventSent IDs on every traced dispatch, even if the response carries no send or the parent is unsampled. In an isolated StartOrchestration benchmark with 10,000 events, send history took about 0.88 ms and 305 KB/op, versus 0.05 ms and 944 B/op for equally long non-send history. Can we build the lookup only when the response has unmatched send candidates, while still checking deferred and suspended acknowledgements?
| } | ||
| sent := action.GetSendEvent() | ||
| o.newSends[action.Id] = o.eventSpan(sent.GetName(), sent.GetInstance().GetInstanceId(), time.Now()) | ||
| } |
There was a problem hiding this comment.
A fake-backend regression test found a gap: buffer a trigger while suspended, then deliver ExecutionResumed and a matching new EventSent in one request. The buffered trigger still has IsReplaying=true, so its first send is not recorded here; the acknowledgement then removes it from the final action list, leaving no producer span. This was not reproduced on DTS. If same-dispatch acknowledgement is supported, distinguish first execution after resume from replay and add this case; otherwise narrow the documented guarantee.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
1efe9b9d411c492ce3593c879ef8895dea5e57c7↑ CI-pinned DTS emulator tests pass; prior event-budget experiment delivered one event and exported one event span without reissuing the send.
↓ Hosted DTS behavior remains unverified.
Part of #175. Stacked on #186.
Summary
When opt-in tracing is enabled,
OrchestrationContext.SendEventnow produces anorchestration_event:<event name>PRODUCER span under the sending orchestration's span, matching the event spans emitted by durabletask-python (emit_event_raised_span) and durabletask-dotnet.Attributes:
durabletask.type=event,durabletask.task.name,durabletask.task.instance_id,durabletask.task.execution_id(when known) anddurabletask.event.target_instance_id.Replay semantics
EventSentacknowledgements of sends from earlier dispatches, emit nothing.EventSenthistory is matched in the same dispatch is exported with that dispatch.Limitations
EventRaised/EventSentcarry no trace context in the protocol, so a send cannot parent or link the receiving orchestration to the sender's event span.Tests
client/grpc_worker_tracing_test.gocovers normal send, replay/redelivery, same-batch history matches, suspended buffering with turn budgets, disabled tracing, unsampled and missing context, continue-as-new in the same turn, and discarded or rejected dispatches.