test(e2e): Port the create-remix-app-express E2E app to span streaming - #24061
Merged
Conversation
Contributor
size-limit report 📦
|
andreiborza
marked this pull request as ready for review
September 4, 2026 11:13
Drops the `traceLifecycle: 'static'` pin and rewrites the specs to assert on streamed spans.
andreiborza
force-pushed
the
ab/e2e-create-remix-app-express-streaming
branch
from
September 4, 2026 12:06
e527fb1 to
7f70cc4
Compare
Lms24
approved these changes
Sep 4, 2026
Lms24
left a comment
Member
There was a problem hiding this comment.
two suggestions but not blocjers
Comment on lines
+78
to
+99
| // Streamed spans are buffered before they flush, so spans from an earlier page load can still be | ||
| // arriving here. | ||
| const streamedSpans: SerializedStreamedSpan[] = []; | ||
| void waitForStreamedSpans(APP_NAME, spans => { | ||
| streamedSpans.push(...spans); | ||
| return false; | ||
| }); | ||
|
|
||
| const pageLoadTransactionPromise = waitForTransaction('create-remix-app-express', transactionEvent => { | ||
| return transactionEvent.contexts?.trace?.op === 'pageload' && transactionEvent.tags?.['sentry_test'] === testTag; | ||
| }); | ||
|
|
||
| page.goto(`/client-error?tag=${testTag}`); | ||
|
|
||
| const pageloadTransaction = await pageLoadTransactionPromise; | ||
| const httpServerTransaction = await httpServerTransactionPromise; | ||
|
|
||
| expect(pageloadTransaction).toBeDefined(); | ||
| expect(httpServerTransaction).toBeDefined(); | ||
|
|
||
| const httpServerTraceId = httpServerTransaction.contexts?.trace?.trace_id; | ||
| const httpServerSpanId = httpServerTransaction.contexts?.trace?.span_id; | ||
| const loaderSpanId = httpServerTransaction?.spans?.find( | ||
| span => span.data && span.data['code.function.name'] === 'loader', | ||
| )?.span_id; | ||
|
|
||
| const pageLoadTraceId = pageloadTransaction.contexts?.trace?.trace_id; | ||
| const pageLoadSpanId = pageloadTransaction.contexts?.trace?.span_id; | ||
| const pageLoadParentSpanId = pageloadTransaction.contexts?.trace?.parent_span_id; | ||
|
|
||
| expect(httpServerTransaction.transaction).toBe('GET client-error'); | ||
| expect(pageloadTransaction.transaction).toBe('/client-error'); | ||
|
|
||
| expect(httpServerTraceId).toBeDefined(); | ||
| expect(httpServerSpanId).toBeDefined(); | ||
|
|
||
| expect(pageLoadTraceId).toEqual(httpServerTraceId); | ||
| expect(pageLoadParentSpanId).toEqual(loaderSpanId); | ||
| expect(pageLoadSpanId).not.toEqual(httpServerSpanId); | ||
| // The ErrorBoundary replaces the document, so there is no `sentry-trace` meta tag to read this | ||
| // page load's trace off. A unique path identifies its server segment instead. | ||
| const id = crypto.randomUUID(); | ||
| await page.goto(`/error-boundary-capture/${id}`); | ||
| await expect(page.locator('#event-id')).not.toBeEmpty(); | ||
|
|
||
| const findServerSegmentSpan = () => | ||
| streamedSpans.find( | ||
| span => | ||
| getSpanOp(span) === 'http.server' && | ||
| span.is_segment && | ||
| span.attributes['url.path']?.value === `/error-boundary-capture/${id}`, | ||
| ); | ||
| await expect.poll(findServerSegmentSpan).toBeDefined(); |
Member
There was a problem hiding this comment.
hmm should we rewrite this with a waitForStreamedSpan condition?
Comment on lines
+8
to
+10
| // Scope tags only reach Sentry on events, so the request emits one to make the tags of its own | ||
| // isolation scope observable. | ||
| Sentry.captureMessage(`scope-bleed-${id}`); |
Member
There was a problem hiding this comment.
we can set an attribute (Sentry.setAttribute) for less of a test change?
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.
What
Removes the
traceLifecycle: 'static'pin from the client entry and the server instrument file, and rewrites the transaction specs as streamed span specs.Two tests could no longer be written the way they were, because scope tags do not reach streamed spans:
sentry-tracemeta tag, or through a unique URL path where the ErrorBoundary replaces the document and there is no meta tag.Why
Span streaming is the default, so the default E2E suite should exercise it.
Ref: #23807