From 4dfc4e0f72e5a94b1cdc849132bf87c131b3d15e Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 16:19:47 +0000 Subject: [PATCH] feat(models/up): log details when returning 503 --- apps/web/src/app/api/models/up/route.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/web/src/app/api/models/up/route.ts b/apps/web/src/app/api/models/up/route.ts index ba10afa238..3563fc263a 100644 --- a/apps/web/src/app/api/models/up/route.ts +++ b/apps/web/src/app/api/models/up/route.ts @@ -206,6 +206,23 @@ export async function GET( const hasSignificantDrop = Object.values(models).some(m => m.monitored && !m.healthy); const status = hasSignificantDrop ? 503 : 200; + if (hasSignificantDrop) { + const unhealthy = Object.entries(models) + .filter(([, m]) => m.monitored && !m.healthy) + .map(([model, m]) => ({ + model, + currentRequests: m.currentRequests, + previousRequests: m.previousRequests, + baselineRequests: m.baselineRequests, + percentChange: m.percentChange, + uniqueUsersBaseline: m.uniqueUsersBaseline, + })); + console.error('[models/up] returning 503: unhealthy monitored models', { + anchorTime: (anchorTime ?? new Date()).toISOString(), + unhealthy, + }); + } + return NextResponse.json( { healthy: !hasSignificantDrop,