diff --git a/cmd/lakefs/cmd/run.go b/cmd/lakefs/cmd/run.go index 917d6fad550..ca6aa3c498d 100644 --- a/cmd/lakefs/cmd/run.go +++ b/cmd/lakefs/cmd/run.go @@ -88,6 +88,8 @@ var runCmd = &cobra.Command{ bufferedCollector := stats.NewBufferedCollector(metadata.InstallationID, cfg) // send metadata bufferedCollector.CollectMetadata(metadata) + // update health info with installation ID + httputil.SetHealthHandlerInfo(metadata.InstallationID) dedupCleaner := dedup.NewCleaner(blockStore, cataloger.DedupReportChannel()) diff --git a/httputil/endpoints.go b/httputil/endpoints.go index a523bb0cbf3..f7983d64e56 100644 --- a/httputil/endpoints.go +++ b/httputil/endpoints.go @@ -1,15 +1,24 @@ package httputil import ( + "io" "net/http" "net/http/pprof" "strings" ) +var healthInfo string + +func SetHealthHandlerInfo(info string) { + healthInfo = info +} + func ServeHealth() http.Handler { - return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { - writer.WriteHeader(http.StatusOK) - _, _ = writer.Write([]byte("alive!")) + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + _, _ = io.WriteString(w, "alive!") + if healthInfo != "" { + _, _ = io.WriteString(w, " "+healthInfo) + } }) }