Skip to content

Commit fde4450

Browse files
authored
Probe a real outbound fetch alongside the local probes (#1673)
Cache and timer probes come back in single-digit ms while the same requests take 4-6s wall, so local I/O is not the cost. Neither probe leaves the isolate. Time a real outbound subrequest, the class the docs proxy implicates (0.098s direct vs 3-6s through the Worker).
1 parent 7277833 commit fde4450

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

apps/cloud/src/server.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,28 @@ const cloudflareHandler: ExportedHandler<Env> = {
210210
await scheduler.wait(1);
211211
const timerProbeMs = Date.now() - timerStartedAt;
212212

213+
// The cache and timer probes are LOCAL. Neither leaves the isolate, and
214+
// both come back in single-digit ms while the same requests take 4-6s.
215+
// This one is a real outbound network subrequest to a small, fast,
216+
// unrelated endpoint — the only class of I/O not yet measured, and the
217+
// one the docs proxy (0.098s direct, 3-6s through the Worker) implicates.
218+
const fetchStartedAt = Date.now();
219+
// oxlint-disable-next-line executor/no-try-catch-or-throw -- temporary diagnostic: a probe failure must not affect the request
220+
try {
221+
await fetch("https://cloudflare.com/cdn-cgi/trace", { method: "GET" });
222+
} catch {
223+
// ignored — the timing is the signal, not the result
224+
}
225+
const fetchProbeMs = Date.now() - fetchStartedAt;
226+
213227
console.log(
214228
JSON.stringify({
215229
probe: "clock-sync",
216230
path: probeUrl.pathname,
217231
preWorkMs,
218232
cacheProbeMs,
219233
timerProbeMs,
234+
fetchProbeMs,
220235
}),
221236
);
222237

0 commit comments

Comments
 (0)