Trace upload fixup (#54455)
This: - Includes Next.js version as metadata - Includes `navigation-to-hydration` timings (note: this metric still needs to be refined to better capture complete hydration) - Updates `client-hmr-latency`'s `updatedModules` to be of the form `[project]/foo.js` instead of `./foo.js`, aligning with other events. Closes WEB-1429
This commit is contained in:
parent
80e6f07f01
commit
7b5f3b354a
3 changed files with 30 additions and 12 deletions
|
@ -90,6 +90,11 @@ const handleSessionStop = async () => {
|
|||
}
|
||||
|
||||
if (traceUploadUrl) {
|
||||
if (isTurboSession) {
|
||||
console.warn(
|
||||
'Uploading traces with Turbopack is not yet supported. Skipping sending trace.'
|
||||
)
|
||||
} else {
|
||||
uploadTrace({
|
||||
traceUploadUrl,
|
||||
mode: 'dev',
|
||||
|
@ -98,6 +103,7 @@ const handleSessionStop = async () => {
|
|||
distDir: config.distDir,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ensure we re-enable the terminal cursor before exiting
|
||||
// the program, or the cursor could remain hidden
|
||||
|
|
|
@ -397,7 +397,9 @@ export default class HotReloader {
|
|||
endTime:
|
||||
BigInt(payload.endTime) * BigInt(MILLISECONDS_IN_NANOSECOND),
|
||||
attrs: {
|
||||
updatedModules: payload.updatedModules,
|
||||
updatedModules: payload.updatedModules.map((m: string) =>
|
||||
m.replace(/^\.\//, '[project]/')
|
||||
),
|
||||
page: payload.page,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ const EVENT_FILTER = new Set([
|
|||
'hot-reloader',
|
||||
'webpack-invalid-client',
|
||||
'webpack-invalidated-server',
|
||||
'navigation-to-hydration',
|
||||
])
|
||||
|
||||
const {
|
||||
|
@ -58,9 +59,17 @@ interface TraceMetadata {
|
|||
pkgName: string
|
||||
platform: string
|
||||
isTurboSession: boolean
|
||||
nextVersion: string
|
||||
}
|
||||
|
||||
;(async function upload() {
|
||||
const nextVersion = JSON.parse(
|
||||
await fsPromise.readFile(
|
||||
path.resolve(__dirname, '../../package.json'),
|
||||
'utf8'
|
||||
)
|
||||
).version
|
||||
|
||||
const projectPkgJsonPath = await findUp('package.json')
|
||||
assert(projectPkgJsonPath)
|
||||
|
||||
|
@ -116,12 +125,13 @@ interface TraceMetadata {
|
|||
|
||||
const body: TraceRequestBody = {
|
||||
metadata: {
|
||||
commit,
|
||||
mode,
|
||||
pkgName,
|
||||
isTurboSession,
|
||||
arch: os.arch(),
|
||||
commit,
|
||||
cpus: os.cpus().length,
|
||||
isTurboSession,
|
||||
mode,
|
||||
nextVersion,
|
||||
pkgName,
|
||||
platform: os.platform(),
|
||||
},
|
||||
traces: [...traces.values()],
|
||||
|
|
Loading…
Reference in a new issue