Make health check failures report their reasons

Note that we add a new block with expanded service info, to avoid breaking compatibility with existing callers of the health endpoint
This commit is contained in:
Joseph Schorr 2017-05-10 21:05:14 -07:00
parent e44a503bd0
commit 4ad3682b9c
4 changed files with 32 additions and 20 deletions

View file

@ -120,15 +120,14 @@ class RedisBuildLogs(object):
connection = redis.StrictRedis(**args)
if not connection.ping() == True:
return False
return (False, 'Could not ping redis')
# Ensure we can write and read a key.
connection.set(self._health_key(), time.time())
connection.get(self._health_key())
return True
except redis.RedisError:
return False
return (True, None)
except redis.RedisError as re:
return (False, 'Could not connect to redis: %s' % re.message)
class BuildLogs(object):