From 5c648d1c19ff16183dc1db0d9070b33b40a5a932 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 9 Dec 2024 15:15:24 +1030 Subject: [PATCH] chore: Warn on healthcheck failure (#248) --- control-plane/src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/control-plane/src/index.ts b/control-plane/src/index.ts index 40b2b29d..9fde2565 100644 --- a/control-plane/src/index.ts +++ b/control-plane/src/index.ts @@ -107,6 +107,15 @@ app.addHook("onRequest", (request, _reply, done) => { ); }); +app.addHook('onResponse', async (request, reply) => { + if (request.routerPath === '/live' && reply.statusCode >= 400) { + logger.warn('Live endpoint returned error', { + statusCode: reply.statusCode, + path: request.url + }) + } +}); + const startTime = Date.now(); (async function start() {