Merge pull request #22164 from open-craft/jill/log-heartbeat-failures

SE-1773 Logs failed heartbeat checks
This commit is contained in:
Ned Batchelder
2020-02-25 16:00:52 -05:00
committed by GitHub

View File

@@ -3,6 +3,7 @@ Views for verifying the health (heartbeat) of the app.
"""
import logging
import six
from util.json_request import JsonResponse
@@ -10,6 +11,9 @@ from util.json_request import JsonResponse
from .runchecks import runchecks
log = logging.getLogger(__name__)
def heartbeat(request):
"""
Simple view that a loadbalancer can check to verify that the app is up. Returns a json doc
@@ -28,4 +32,7 @@ def heartbeat(request):
status_code = 503
check_results = {'error': six.text_type(e)}
if status_code == 503:
log.error(u'Heartbeat check failed (%s): %s', status_code, check_results)
return JsonResponse(check_results, status=status_code)