Skip to content

test(node-integration): Collect traces that arrive in several envelopes - #26480

Merged
s1gr1d merged 2 commits into
developfrom
sig/test-node-split-traces
Nov 17, 2026
Merged

s1gr1d merged 2 commits into
developfrom
sig/test-node-split-traces

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

❗ Use "Hide Whitespace" to only see around 50 LOC changed.

What

  • Four apollo-graphql/useOperationNameForRootSpan tests and the Mastra multi-instance test collect the spans of a trace with collectStreamedSpansUntilSegment, and assert on the collected spans.
  • The auto-flush preload of the test runner registers its beforeExit handler with once.

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-flush change is not a flake fix. flush() sets a timer, so beforeExit fired 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

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.
@github-actions

Copy link
Copy Markdown
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.

Path Size % Change Change
@sentry/browser 30.1 kB - -
@sentry/browser - with treeshaking flags 28.3 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.2 kB - -
@sentry/browser (incl. Tracing) 52.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.25 kB - -
@sentry/browser (incl. Tracing, Replay) 92.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.21 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.73 kB - -
@sentry/browser (incl. sendFeedback) 30.69 kB - -
@sentry/browser (incl. FeedbackAsync) 35.69 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.71 kB - -
@sentry/browser (incl. Metrics & Logs) 32.37 kB - -
@sentry/react 32.11 kB - -
@sentry/react (incl. Tracing) 54.95 kB - -
@sentry/vue 38.29 kB - -
@sentry/vue (incl. Tracing) 55.24 kB - -
@sentry/svelte 30.12 kB - -
@sentry/remix (Remix 3 client bundle) 58.06 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 34.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.69 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.45 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.44 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.61 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.02 kB - -
@sentry/nextjs (client) 58.57 kB - -
@sentry/sveltekit (client) 53.57 kB - -
@sentry/core/server 44.8 kB - -
@sentry/core/browser 14.4 kB - -
@sentry/node 151.66 kB -0.01% -5 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.33 kB - -
@sentry/node - without tracing 88.59 kB -0.01% -5 B 🔽
@sentry/node - without channel injection 140.62 kB -0.01% -3 B 🔽
@sentry/aws-serverless 98.96 kB -0.01% -8 B 🔽
@sentry/cloudflare (withSentry) - minified 206.71 kB - -
@sentry/cloudflare (withSentry) 479.81 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 232.07 kB - -

View base workflow run

@s1gr1d
s1gr1d marked this pull request as ready for review November 17, 2026 13:48
@s1gr1d
s1gr1d merged commit 1e38e20 into develop Nov 17, 2026
96 checks passed
@s1gr1d
s1gr1d deleted the sig/test-node-split-traces branch November 17, 2026 14:11
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.

2 participants