diff --git a/etcdserver/api/etcdhttp/metrics.go b/etcdserver/api/etcdhttp/metrics.go index ef3d9544e10..e5c062e4372 100644 --- a/etcdserver/api/etcdhttp/metrics.go +++ b/etcdserver/api/etcdhttp/metrics.go @@ -117,8 +117,7 @@ func checkHealth(srv etcdserver.ServerV2, excludedAlarms AlarmSet) Health { for _, v := range as { alarmName := v.Alarm.String() if _, found := excludedAlarms[alarmName]; found { - plog.Debugf("/health excluded alarm %s", alarmName) - delete(excludedAlarms, alarmName) + plog.Debugf("/health excluded alarm %s", v.String()) continue } h.Health = "false" @@ -127,10 +126,6 @@ func checkHealth(srv etcdserver.ServerV2, excludedAlarms AlarmSet) Health { } } - if len(excludedAlarms) > 0 { - plog.Warningf("fail exclude alarms from health check, exclude alarms %+v", excludedAlarms) - } - if h.Health == "true" { if uint64(srv.Leader()) == raft.None { h.Health = "false" diff --git a/etcdserver/api/etcdhttp/metrics_test.go b/etcdserver/api/etcdhttp/metrics_test.go index b24fec1158e..3468d9fd60d 100644 --- a/etcdserver/api/etcdhttp/metrics_test.go +++ b/etcdserver/api/etcdhttp/metrics_test.go @@ -91,6 +91,12 @@ func TestHealthHandler(t *testing.T) { http.StatusOK, "true", }, + { + []*pb.AlarmMember{{MemberID: uint64(1), Alarm: pb.AlarmType_NOSPACE}, {MemberID: uint64(2), Alarm: pb.AlarmType_NOSPACE}, {MemberID: uint64(3), Alarm: pb.AlarmType_NOSPACE}}, + "/health?exclude=NOSPACE", + http.StatusOK, + "true", + }, { []*pb.AlarmMember{{MemberID: uint64(0), Alarm: pb.AlarmType_NOSPACE}, {MemberID: uint64(1), Alarm: pb.AlarmType_CORRUPT}}, "/health?exclude=NOSPACE",