You've already forked oncall
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user