-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trace upload: only send traces for current session (#71838)
The `.next/trace` file contains trace events spanning multiple traces from different sessions. This changes our upload process to only send trace events for the current session that’s ending. Before this change, we would send a single set of metadata for many traces, but these older session traces could have been invoked with different parameters like `mode`, `isTurboSession`, etc. Because of this, we started including `isTurboSession` as a span attribute on spans, but this value was dependent on an environment variable that wasn’t always set. In this case, the top-level `next-dev` span never had the correct value. This makes it so the metadata, now always determined at upload time, always reflects the session sent, and never any others. Other bugs fixed: - Trace events within a single logical session had different trace ids because of worker threads. This aligns them. - Because we upload traces out-of-process, the Telemetry `sessionId` did not reflect the real session id of other analytics sent. This passes it along to the external process. Test Plan: In a test app, using `NEXT_TRACE_UPLOAD_DEBUG=1` and a running Otel server: - Start a non-turbopack dev session and end it. Verify trace events are sent with `isTurboSession: false` and note the trace id. - Start a turbopack dev session and end it. Verify trace events are sent with `isTurboSession: true` and note events are sent for this trace, and not the previous one. - Start a build and verify trace events are sent with `mode: build` and `isTurboSession: false` and that no older trace events are sent. Closes PACK-3338
- Loading branch information
1 parent
f9b281a
commit 6ee3d4b
Showing
7 changed files
with
49 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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