root: handle JSON error in metrics too

this can happen when the worker is killed while writing metrics
This commit is contained in:
Jens Langhammer 2022-04-29 11:01:04 +00:00
parent cd1d1b4402
commit 1ede972222

View file

@ -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)