From 1ede97222260d00a3ae25aa2a4f7de6c6e562271 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 29 Apr 2022 11:01:04 +0000 Subject: [PATCH] root: handle JSON error in metrics too this can happen when the worker is killed while writing metrics --- authentik/root/monitoring.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/authentik/root/monitoring.py b/authentik/root/monitoring.py index 5ff02e0d6..17deefb65 100644 --- a/authentik/root/monitoring.py +++ b/authentik/root/monitoring.py @@ -1,5 +1,6 @@ """Metrics view""" from base64 import b64encode +from json import JSONDecodeError from django.conf import settings from django.db import connections @@ -33,7 +34,7 @@ class MetricsView(View): try: return ExportToDjangoView(request) - except (UnicodeDecodeError, KeyError, ValueError): + except (UnicodeDecodeError, KeyError, ValueError, JSONDecodeError): return HttpResponse(status_code=500)