HuangTing-Yao commented on a change in pull request #395:
URL: https://github.com/apache/yunikorn-core/pull/395#discussion_r835743979
##########
File path: pkg/webservice/handlers.go
##########
@@ -516,14 +516,23 @@ func isChecksumEqual(checksum string) bool {
func checkHealthStatus(w http.ResponseWriter, r *http.Request) {
writeHeaders(w)
- metrics := metrics2.GetSchedulerMetrics()
- result := scheduler.GetSchedulerHealthStatus(metrics, schedulerContext)
- if !result.Healthy {
- log.Logger().Error("Scheduler is not healthy", zap.Any("health
check values", result.HealthChecks))
- buildJSONErrorResponse(w, "Scheduler is not healthy",
http.StatusServiceUnavailable)
- }
- if err := json.NewEncoder(w).Encode(result); err != nil {
- buildJSONErrorResponse(w, err.Error(),
http.StatusInternalServerError)
+
+ // Fetch last healthCheck result
+ result := schedulerContext.GetLastHealthCheckResult()
+ if result != nil {
+ if !result.Healthy {
+ log.Logger().Error("Scheduler is not healthy",
zap.Any("health check info", *result))
+ buildJSONErrorResponse(w, "Scheduler is not healthy",
http.StatusServiceUnavailable)
+ } else {
+ log.Logger().Info("Scheduler is healthy",
zap.Any("health check info", *result))
+ buildJSONErrorResponse(w, "Scheduler is healthy",
http.StatusOK)
Review comment:
When scheduler is healthy, we shouldn't log it with `ERROR` level.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]