From c35c90aa68a3802de3f9dbfb858612136a9be22a Mon Sep 17 00:00:00 2001 From: Pavel Zavora Date: Tue, 26 May 2020 14:02:38 +0200 Subject: [PATCH] feat(api/health): report commit --- http/health.go | 2 +- http/health_test.go | 3 +++ http/swagger.yml | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/http/health.go b/http/health.go index a6a4740c685..9d7ff084244 100644 --- a/http/health.go +++ b/http/health.go @@ -9,7 +9,7 @@ import ( // HealthHandler returns the status of the process. func HealthHandler(w http.ResponseWriter, r *http.Request) { - msg := fmt.Sprintf(`{"name":"influxdb", "message":"ready for queries and writes", "status":"pass", "checks":[], "version": %q}`, platform.GetBuildInfo().Version) + msg := fmt.Sprintf(`{"name":"influxdb", "message":"ready for queries and writes", "status":"pass", "checks":[], "version": %q, "commit": %q}`, platform.GetBuildInfo().Version, platform.GetBuildInfo().Commit) w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(http.StatusOK) fmt.Fprintln(w, msg) diff --git a/http/health_test.go b/http/health_test.go index fb012daf18f..93070576e68 100644 --- a/http/health_test.go +++ b/http/health_test.go @@ -64,6 +64,9 @@ func TestHealthHandler(t *testing.T) { if _, found := content["version"]; !found { t.Errorf("%q. HealthHandler() no version reported", tt.name) } + if _, found := content["commit"]; !found { + t.Errorf("%q. HealthHandler() no commit reported", tt.name) + } }) } } diff --git a/http/swagger.yml b/http/swagger.yml index 95c010d5984..de269f28cac 100644 --- a/http/swagger.yml +++ b/http/swagger.yml @@ -10895,6 +10895,8 @@ components: - fail version: type: string + commit: + type: string Labels: type: array items: