Skip to content

Commit

Permalink
etcdserver/api/etcdhttp: log successful etcd server side health check…
Browse files Browse the repository at this point in the history
… 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 etcd-io#11704.

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

Fixes etcd-io#12676
  • Loading branch information
chaochn47 committed Feb 9, 2021
1 parent 96a9860 commit 2ae3e82
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/etcdserver/api/etcdhttp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

0 comments on commit 2ae3e82

Please sign in to comment.