Skip to content

test(nextjs): Fix flaky nextjs-16 metrics tests - #25517

Open
sentry-junior[bot] wants to merge 2 commits into
developfrom
test/nextjs-16-flaky-metrics
Open

sentry-junior[bot] wants to merge 2 commits into
developfrom
test/nextjs-16-flaky-metrics

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

The Should emit metrics from server and client test in nextjs-16 intermittently failed because the client test.page.count metric had no span_id. Metrics only get a span_id when a span is active at capture time (packages/core/src/metrics/internal.ts), and the click handler relied on the pageload idle span still being open when Playwright clicked. That's a timing race, and the slower next dev --webpack run is where it keeps losing: all four recent failures came from the development-webpack pass.

The metrics page now emits the client metrics inside an explicit Sentry.startSpan, so a span is always active and the existing span_id assertions stay strict. The same fix is applied to nextjs-16-static, which has an identical page and assertions.

via Francesco Gringl-Novy.

--

View Junior Session [Sentry]

sentry-junior Bot and others added 2 commits October 19, 2026 12:47
Co-Authored-By: Francesco Gringl-Novy <francesco.novy@sentry.io>
Co-Authored-By: Francesco Gringl-Novy <francesco.novy@sentry.io>
@sentry-junior sentry-junior Bot changed the title test(nextjs): Fix flaky nextjs-16 metrics test test(nextjs): Fix flaky nextjs-16 metrics tests Oct 19, 2026
@mydea
mydea marked this pull request as ready for review October 19, 2026 14:10
@mydea
mydea requested review from a team, chargome and s1gr1d and removed request for a team October 19, 2026 14:10
@mydea mydea self-assigned this Oct 19, 2026

This branch has not been deployed

No deployments
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.

1 participant