etcdserver/api/etcdhttp: log successful etcd server side health check in debug level

When we have an external component that checks /health periodically, the
etcd server logs can be quite verbose (e.g., DDOS-ing against insure
etcd health check can lead to disk space full due to large log files).

This change was introduced in #11704.

While we keep the warning logs for etcd health check failures, the
success (or OK) log level should be set to DEBUG.

Fixes #12676
This commit is contained in:
Chao Chen 2021-02-08 17:06:38 -08:00
parent 96a9860b60
commit 2ae3e82f07

View File

@ -79,7 +79,7 @@ func NewHealthHandler(lg *zap.Logger, hfunc func() Health) http.HandlerFunc {
}
w.WriteHeader(http.StatusOK)
w.Write(d)
lg.Info("/health OK", zap.Int("status-code", http.StatusOK))
lg.Debug("/health OK", zap.Int("status-code", http.StatusOK))
}
}
@ -154,7 +154,7 @@ func checkV2Health(lg *zap.Logger, srv etcdserver.ServerV2) (h Health) {
lg.Warn("serving /health false; QGET fails", zap.Error(err))
return
}
lg.Info("serving /health true")
lg.Debug("serving /health true")
return
}
@ -171,6 +171,6 @@ func checkV3Health(lg *zap.Logger, srv *etcdserver.EtcdServer) (h Health) {
lg.Warn("serving /health false; Range fails", zap.Error(err))
return
}
lg.Info("serving /health true")
lg.Debug("serving /health true")
return
}