Repository navigation
test(node-integration): Collect traces that arrive in several envelopes - #26480
Merged
Merged
Conversation
With span streaming, the SDK flushes 500 ms after any segment ends, so the spans of one trace can arrive in more than one envelope. Four apollo-graphql tests and one Mastra test asserted the whole trace on the first envelope. They now collect the spans of the trace until its segment arrives, and assert on the collected spans.
`flush()` sets a timer, so `beforeExit` fired again after each flush and the scenario process never exited on its own. A test with an expectation that is not met then waited for the full test timeout, and now fails when the process exits.
Contributor
size-limit report 📦Compared: 6b3b5b9 (PR test merge using develop at 524bd26) Against: 524bd26 (develop) · base run #66453 ✅ Baseline matches: this diff contains only this PR's changes.
|
s1gr1d
marked this pull request as ready for review
November 17, 2026 13:48
javascript-sdk-gitflow
Bot
requested review from
RulaKhaled,
andreiborza and
isaacs
November 17, 2026 13:48
andreiborza
approved these changes
Nov 17, 2026
51 tasks done
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.
❗ Use "Hide Whitespace" to only see around 50 LOC changed.
What
apollo-graphql/useOperationNameForRootSpantests and the Mastra multi-instance test collect the spans of a trace withcollectStreamedSpansUntilSegment, and assert on the collected spans.auto-flushpreload of the test runner registers itsbeforeExithandler withonce.Why
With span streaming, the SDK flushes 500 ms after any segment ends. The spans of one trace can then arrive in two envelopes. These tests asserted the whole trace on the first envelope and failed about 20 times in the last month when the trace was split. #26151 fixed the same pattern for the typesafe suite. Every assertion on names, attributes, origins, and status is unchanged.
One difference: an error event that arrives before the first span envelope no longer fails these tests, because a collector reads span envelopes only.
The
auto-flushchange is not a flake fix.flush()sets a timer, sobeforeExitfired again after each flush and a finished scenario never exited. A test with an expectation that was not met waited for the full 15 s timeout; it now fails in about 3 s with "Scenario exited".Ref #26477