From 50775d1fe3aabb6d16ab59209380c65f2ac52290 Mon Sep 17 00:00:00 2001 From: Yoom Lam Date: Fri, 7 Jun 2024 08:14:28 -0500 Subject: [PATCH] add hostname to healthcheck --- 05-assistive-chatbot/chatbot_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/05-assistive-chatbot/chatbot_api.py b/05-assistive-chatbot/chatbot_api.py index 036da3d..6601557 100755 --- a/05-assistive-chatbot/chatbot_api.py +++ b/05-assistive-chatbot/chatbot_api.py @@ -8,6 +8,8 @@ import logging import os +import platform +import socket from functools import cached_property from io import StringIO from typing import Dict @@ -57,9 +59,10 @@ def healthcheck(request: Request): git_sha = os.environ.get("GIT_SHA", "") build_date = os.environ.get("BUILD_DATE", "") + hostname = f"{platform.node()} {socket.gethostname()}" logger.info("Returning: Healthy %s %s", build_date, git_sha) - return HTMLResponse(f"Healthy {build_date} {git_sha}") + return HTMLResponse(f"Healthy {build_date} {git_sha}
{hostname}") ALLOWED_ENV_VARS = ["CHATBOT_LOG_LEVEL"]