fix: include same-batch events in tracing processing#275
Open
YunchuWang wants to merge 1 commit into
Open
Conversation
… same-batch events processNewEventsForTracing() only indexed pastEvents when building its scheduling-event lookup maps. When a task was scheduled and completed within the same event batch (both in newEvents), the corresponding tracing span was silently dropped because the scheduling event was never indexed. Fix: also index newEvents into the lookup maps so that same-batch completions can find their scheduling counterparts. Added 4 new test cases covering same-batch scenarios for: - Activity scheduled + completed in same batch - Activity scheduled + failed in same batch - Sub-orchestration created + completed in same batch - Timer created + fired in same batch Fixes #229 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a tracing/observability gap in the Durable Task JS SDK where retroactive spans could be silently skipped when a scheduling event and its completion/failure arrive in the same newEvents batch (fast activities, sub-orchestrations, and timers). It aligns span emission with actual history availability by indexing scheduling events from both past and current event batches.
Changes:
- Extend
processNewEventsForTracing()to index scheduling events fromnewEventsin addition topastEvents, enabling same-batch completion lookups. - Add unit tests covering same-batch activity completion/failure, sub-orchestration completion, and timer firing span emission.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/durabletask-js/src/tracing/trace-helper.ts | Index scheduling events from both pastEvents and newEvents so same-batch completions can emit retroactive spans. |
| packages/durabletask-js/test/tracing.spec.ts | Adds regression tests ensuring spans are emitted when scheduling + completion/failure occur within the same newEvents batch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #229