feat: Added more debug logging
This commit is contained in:
@@ -32,17 +32,25 @@ async function fetchSnapshot(host: string, forwardedFor: string, pageId: string)
|
||||
// intact.
|
||||
if (forwardedFor) outbound["X-Forwarded-For"] = forwardedFor;
|
||||
|
||||
const url = `${base}/public/status/${encodeURIComponent(pageId)}`;
|
||||
// This call is container-to-container and never appears in the front
|
||||
// proxy's access log, which is why a 404 here reads as "Next 404'd it".
|
||||
// Log both halves so the upstream status is visible in the web logs.
|
||||
console.log(`[status] GET ${url} host=${host} xff=${forwardedFor || "-"}`);
|
||||
|
||||
let res: Response;
|
||||
try {
|
||||
res = await fetch(`${base}/public/status/${encodeURIComponent(pageId)}`, {
|
||||
res = await fetch(url, {
|
||||
headers: outbound,
|
||||
cache: "no-store",
|
||||
});
|
||||
} catch {
|
||||
} catch (e) {
|
||||
// The control plane is unreachable. That is not "no such page".
|
||||
console.error(`[status] upstream unreachable ${url}:`, e);
|
||||
return { kind: "unavailable" };
|
||||
}
|
||||
|
||||
console.log(`[status] upstream ${res.status} for ${url}`);
|
||||
if (res.status === 404) return { kind: "not-found" };
|
||||
// A 429, a 500 or anything else is a page that exists and cannot be read
|
||||
// right now. Telling a customer mid-outage that their status page does not
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user