Skip to content

Commit

Permalink
feat(api/health): report commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sranka committed May 26, 2020
1 parent 634d835 commit c35c90a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion http/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions http/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}
2 changes: 2 additions & 0 deletions http/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10895,6 +10895,8 @@ components:
- fail
version:
type: string
commit:
type: string
Labels:
type: array
items:
Expand Down

0 comments on commit c35c90a

Please sign in to comment.