root: handle JSON error in metrics too
this can happen when the worker is killed while writing metrics
This commit is contained in:
parent
cd1d1b4402
commit
1ede972222
|
@ -1,5 +1,6 @@
|
||||||
"""Metrics view"""
|
"""Metrics view"""
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
|
from json import JSONDecodeError
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connections
|
from django.db import connections
|
||||||
|
@ -33,7 +34,7 @@ class MetricsView(View):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return ExportToDjangoView(request)
|
return ExportToDjangoView(request)
|
||||||
except (UnicodeDecodeError, KeyError, ValueError):
|
except (UnicodeDecodeError, KeyError, ValueError, JSONDecodeError):
|
||||||
return HttpResponse(status_code=500)
|
return HttpResponse(status_code=500)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue