Unverified Commit 4c3d1926 authored by Josh Story's avatar Josh Story Committed by GitHub

Use perf_hooks for fetch metrics timers (#70924)

These are better for telemetry and Date.now() will start to be dynamic
in prerenders
parent cbf32150
......@@ -93,7 +93,7 @@ function logFetchMetric(
writeLine(
white(
`${method} ${url} ${status} in ${end - start}ms ${formatCacheStatus(cacheStatus)}`
`${method} ${url} ${status} in ${Math.round(end - start)}ms ${formatCacheStatus(cacheStatus)}`
),
1
)
......
......@@ -220,7 +220,7 @@ function trackFetchMetric(
workStore.fetchMetrics.push({
...ctx,
end: Date.now(),
end: performance.timeOrigin + performance.now(),
idx: workStore.nextFetchId || 0,
})
}
......@@ -250,7 +250,7 @@ export function createPatchedFetcher(
url = undefined
}
const fetchUrl = url?.href ?? ''
const fetchStart = Date.now()
const fetchStart = performance.timeOrigin + performance.now()
const method = init?.method?.toUpperCase() || 'GET'
// Do create a new span trace for internal fetches in the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment