feat(api/health): report commit
parent
634d83577c
commit
c35c90aa68
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
// HealthHandler returns the status of the process.
|
// HealthHandler returns the status of the process.
|
||||||
func HealthHandler(w http.ResponseWriter, r *http.Request) {
|
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.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
fmt.Fprintln(w, msg)
|
fmt.Fprintln(w, msg)
|
||||||
|
|
|
@ -64,6 +64,9 @@ func TestHealthHandler(t *testing.T) {
|
||||||
if _, found := content["version"]; !found {
|
if _, found := content["version"]; !found {
|
||||||
t.Errorf("%q. HealthHandler() no version reported", tt.name)
|
t.Errorf("%q. HealthHandler() no version reported", tt.name)
|
||||||
}
|
}
|
||||||
|
if _, found := content["commit"]; !found {
|
||||||
|
t.Errorf("%q. HealthHandler() no commit reported", tt.name)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10895,6 +10895,8 @@ components:
|
||||||
- fail
|
- fail
|
||||||
version:
|
version:
|
||||||
type: string
|
type: string
|
||||||
|
commit:
|
||||||
|
type: string
|
||||||
Labels:
|
Labels:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
|
Loading…
Reference in New Issue