1
0
mirror of https://github.com/linkedin/oncall.git synced 2025-11-30 23:44:59 +02:00

add error logging to healtcheck

This commit is contained in:
Diego Cepeda
2022-01-31 17:31:09 -08:00
parent 8c94bbbcad
commit db720b2358

View File

@@ -4,6 +4,9 @@
from falcon import HTTPNotFound, HTTPInternalServerError
from . import db
import logging
logger = logging.getLogger('oncall.app')
class HealthCheck(object):
@@ -29,11 +32,13 @@ class HealthCheck(object):
cursor.close()
connection.close()
except:
logger.exception('failed to query DB for healthcheck')
raise HTTPInternalServerError()
try:
with open(self.path) as f:
status = f.readline().strip()
except:
logger.error('could not find healthcheck file')
raise HTTPNotFound()
resp.content_type = 'text/plain'
resp.body = status