test: avoid OpenTelemetry collector socket reuse (#98632)
### What? Prevent the OpenTelemetry instrumentation e2e collector from losing span exports when an exporter reuses an idle localhost connection. Add focused coverage for the collector's connection behavior. ### Why? Keeping the collector listener alive for each application's full lifetime removed the earlier close-and-rebind gap, but did not eliminate every socket failure. Node's HTTP server could still time out an idle keep-alive socket retained by the exporter's Undici pool. A later export could race that closure, lose spans with `UND_ERR_SOCKET` or `ECONNRESET`, and leave otherwise unrelated trace assertions with incomplete trees. The canary.28 failure was investigated separately and is not this mechanism: it occurred in the release-enabled Rspack matrix when a custom server exited during startup. This change is limited to the residual non-Rspack collector race and does not alter Rspack coverage or release snapshots. ### How? Successful collector exports explicitly close their HTTP connection. Each export therefore uses a fresh local connection instead of retaining a socket that the server may reclaim while idle. The regression test asserts this response contract directly, avoiding timing-dependent coverage of the race. ### Verification - Node 20.9.0, webpack dev, React 18.3.1: 5 consecutive focused runs, 55 tests passed per run - Node 20.9.0, webpack start, React 18.3.1: 99 passed, 13 existing skips - `pnpm test-types` - Prettier and ESLint on changed files <!-- NEXT_JS_LLM --> <!-- fleet e4b8ed15-4a06-4727-a634-fddcc27c11fc --> Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment