def process_request(self, request): # Our health check can't be a done as a view, because we need # to bypass the ALLOWED_HOSTS check. We need to do this # since not all load balancers can send the expected Host header # which would cause a 400 BAD REQUEST, marking the node dead. # Instead, we just intercept the request at this point, and return # our success/failure immediately. if request.path != '/_health/': return if 'full' not in request.GET: return HttpResponse('ok', content_type='text/plain') from sentry.status_checks import Problem, check_all from sentry.utils import json threshold = Problem.threshold(Problem.SEVERITY_CRITICAL) results = {check: filter(threshold, problems) for check, problems in check_all().items()} problems = list(itertools.chain.from_iterable(results.values())) return HttpResponse( json.dumps( { 'problems': [six.text_type(p) for p in problems], 'healthy': {type(check).__name__: not p for check, p in results.items()}, } ), content_type='application/json', status=(500 if problems else 200) )
def show_system_status(context): problems = itertools.chain.from_iterable( status_checks.check_all().values(), ) return { 'problems': sort_by_severity(problems), }
def process_request(self, request): # Our health check can't be a done as a view, because we need # to bypass the ALLOWED_HOSTS check. We need to do this # since not all load balancers can send the expected Host header # which would cause a 400 BAD REQUEST, marking the node dead. # Instead, we just intercept the request at this point, and return # our success/failure immediately. if request.path != "/_health/": return if "full" not in request.GET: return HttpResponse("ok", content_type="text/plain") from sentry.status_checks import Problem, check_all from sentry.utils import json threshold = Problem.threshold(Problem.SEVERITY_CRITICAL) results = { check: filter(threshold, problems) for check, problems in check_all().items() } problems = list(itertools.chain.from_iterable(results.values())) return HttpResponse( json.dumps({ "problems": [six.text_type(p) for p in problems], "healthy": {type(check).__name__: not p for check, p in results.items()}, }), content_type="application/json", status=(500 if problems else 200), )
def show_system_status(context): problems = list( itertools.chain.from_iterable(status_checks.check_all().values())) return { 'problems': problems, }
def get(self, request): problems, checks = status_checks.check_all() return Response({ 'problems': map(unicode, problems), 'healthy': checks, })
def handler_healthcheck(request): if request.GET.get('full'): problems, checks = status_checks.check_all() return HttpResponse(json.dumps({ 'problems': map(unicode, problems), 'healthy': checks, }), content_type='application/json', status=(500 if problems else 200))
def handler_healthcheck(request): if request.GET.get('full'): problems = status_checks.check_all() if problems: return HttpResponse(json.dumps({ 'problems': map(unicode, problems), }), content_type='application/json', status=500) return HttpResponse('ok')
def get(self, request): results = status_checks.check_all() return Response({ 'problems': map( lambda problem: { 'message': problem.message, 'severity': problem.severity, }, itertools.chain.from_iterable(results.values()), ), 'healthy': {type(check).__name__: not problems for check, problems in results.items()}, })
def handler_healthcheck(request): problems, checks = status_checks.check_all() if request.GET.get("full"): return HttpResponse( json.dumps({"problems": map(unicode, problems), "healthy": checks}), content_type="application/json", status=(500 if problems else 200), ) elif problems: return handler500(request) else: return HttpResponse("ok")
def get(self, request): results = status_checks.check_all() return Response({ 'problems': [ { 'id': md5_text(problem.message).hexdigest(), 'message': problem.message, 'severity': problem.severity, 'url': problem.url, } for problem in sorted(itertools.chain.from_iterable(results.values()), reverse=True) ], 'healthy': {type(check).__name__: not problems for check, problems in results.items()}, })
def get(self, request): results = status_checks.check_all() return Response({ 'problems': [{ 'id': md5_text(problem.message).hexdigest(), 'message': problem.message, 'severity': problem.severity, 'url': problem.url, } for problem in sort_by_severity( itertools.chain.from_iterable(results.values()))], 'healthy': { type(check).__name__: not problems for check, problems in results.items() }, })
def get(self, request): results = status_checks.check_all() return Response( { "problems": map( lambda problem: { "id": md5(problem.message).hexdigest(), "message": problem.message, "severity": problem.severity, "url": problem.url, }, sorted(itertools.chain.from_iterable(results.values()), reverse=True), ), "healthy": {type(check).__name__: not problems for check, problems in results.items()}, } )
def get(self, request): results = status_checks.check_all() return Response({ 'problems': map( lambda problem: { 'message': problem.message, 'severity': problem.severity, 'url': problem.url, }, itertools.chain.from_iterable(results.values()), ), 'healthy': { type(check).__name__: not problems for check, problems in results.items() }, })
def get(self, request): if not is_active_superuser(request): return Response() results = status_checks.check_all() return Response({ "problems": [{ "id": md5_text(problem.message).hexdigest(), "message": problem.message, "severity": problem.severity, "url": problem.url, } for problem in sort_by_severity( itertools.chain.from_iterable(results.values()))], "healthy": { type(check).__name__: not problems for check, problems in results.items() }, })
def process_request(self, request): # Our health check can't be a done as a view, because we need # to bypass the ALLOWED_HOSTS check. We need to do this # since not all load balancers can send the expected Host header # which would cause a 400 BAD REQUEST, marking the node dead. # Instead, we just intercept the request at this point, and return # our success/failure immediately. if request.path != '/_health/': return if 'full' not in request.GET: return HttpResponse('ok', content_type='text/plain') from sentry.status_checks import check_all from sentry.utils import json problems, checks = check_all() return HttpResponse(json.dumps({ 'problems': map(unicode, problems), 'healthy': checks, }), content_type='application/json', status=(500 if problems else 200))
def show_system_status(context): problems, _ = status_checks.check_all() return { 'problems': problems, }
def show_system_status(context): problems = list(itertools.chain.from_iterable(status_checks.check_all().values())) return { 'problems': problems, }