Skip the database check filtering if not present, such as on warnings
This commit is contained in:
parent
18e5550f74
commit
fcfc81806c
1 changed files with 11 additions and 10 deletions
|
@ -120,6 +120,8 @@ class LocalHealthCheck(HealthCheck):
|
|||
class RDSAwareHealthCheck(HealthCheck):
|
||||
def __init__(self, app, config_provider, instance_keys, access_key, secret_key,
|
||||
db_instance='quay', region='us-east-1'):
|
||||
# Note: We skip the redis check because if redis is down, we don't want ELB taking the
|
||||
# machines out of service. Redis is not considered a high avaliability-required service.
|
||||
super(RDSAwareHealthCheck, self).__init__(app, config_provider, instance_keys, [
|
||||
'redis', 'storage'])
|
||||
|
||||
|
@ -133,23 +135,22 @@ class RDSAwareHealthCheck(HealthCheck):
|
|||
return ['RDSAwareHealthCheck', 'ProductionHealthCheck']
|
||||
|
||||
def get_instance_health(self, service_statuses):
|
||||
# Note: We skip the redis check because if redis is down, we don't want ELB taking the
|
||||
# machines out of service. Redis is not considered a high avaliability-required service.
|
||||
skip = []
|
||||
notes = []
|
||||
|
||||
# If the database is marked as unhealthy, check the status of RDS directly. If RDS is
|
||||
# reporting as available, then the problem is with this instance. Otherwise, the problem is
|
||||
# with RDS, and so we skip the DB status so we can keep this machine as 'healthy'.
|
||||
db_healthy = service_statuses['database']
|
||||
if not db_healthy:
|
||||
rds_status = self._get_rds_status()
|
||||
notes.append('DB reports unhealthy; RDS status: %s' % rds_status)
|
||||
if 'database' in service_statuses:
|
||||
db_healthy = service_statuses['database']
|
||||
if not db_healthy:
|
||||
rds_status = self._get_rds_status()
|
||||
notes.append('DB reports unhealthy; RDS status: %s' % rds_status)
|
||||
|
||||
# If the RDS is in any state but available, then we skip the DB check since it will
|
||||
# fail and bring down the instance.
|
||||
if rds_status != 'available':
|
||||
skip.append('database')
|
||||
# If the RDS is in any state but available, then we skip the DB check since it will
|
||||
# fail and bring down the instance.
|
||||
if rds_status != 'available':
|
||||
skip.append('database')
|
||||
|
||||
return self.calculate_overall_health(service_statuses, skip=skip, notes=notes)
|
||||
|
||||
|
|
Reference in a new issue