From a9c088f5c4a00d5b3bbfdeeca492d027875bb1be Mon Sep 17 00:00:00 2001 From: Simon Panay <simon.panay@univ-grenoble-alpes.fr> Date: Fri, 28 Feb 2025 17:14:26 +0100 Subject: [PATCH] views : add healthcheckviews for kubernetes probles --- start_timeseries.py | 9 ++++++++- start_timeseriesplot.py | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/start_timeseries.py b/start_timeseries.py index 27f0ab6..cdf6af1 100644 --- a/start_timeseries.py +++ b/start_timeseries.py @@ -80,7 +80,14 @@ def version(): @app.route("/commit", strict_slashes=False) def commit(): - response = make_response(os.environ.get("COMMIT"), "unspecified") + response = make_response(os.environ.get("COMMIT", "unspecified")) + response.headers["Content-Type"] = "text/plain" + return response + + +@app.route("/healthcheck", strict_slashes=False) +def healthcheck(): + response = make_response("OK") response.headers["Content-Type"] = "text/plain" return response diff --git a/start_timeseriesplot.py b/start_timeseriesplot.py index 6438e62..cac232a 100644 --- a/start_timeseriesplot.py +++ b/start_timeseriesplot.py @@ -78,7 +78,14 @@ def version(): @app.route("/commit", strict_slashes=False) def commit(): - response = make_response(os.environ.get("COMMIT"), "unspecified") + response = make_response(os.environ.get("COMMIT", "unspecified")) + response.headers["Content-Type"] = "text/plain" + return response + + +@app.route("/healthcheck", strict_slashes=False) +def healthcheck(): + response = make_response("OK") response.headers["Content-Type"] = "text/plain" return response -- GitLab