Skip to content

.tip

· one of the small things

One request id, on every log line, across every service

Generate one at the edge if the client didn't send one, put it in a header, log it on every line, and pass it to every downstream call.

const requestId = req.headers.get("x-request-id") ?? crypto.randomUUID();
logger = logger.child({ requestId });
await fetch(url, { headers: { "x-request-id": requestId } });

Then "what happened to request 8f2a" becomes one search across every service's logs. Without it, you're guessing.

observability