open-metrics fail to render
Requesting /api/1.0/open-metrics/
results in {"title": "Error"}
on both debusine.f.c and debusine.d.n. The upshot is that this is not an internal server error and it's not spamming our mail log and it gives a traceback in the errors.log
:
Server exception. status_code: 400 detail: None traceback: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debusine/server/views/open_metrics.py", line 90, in get
data = openmetrics.generate_latest(registry()) # type: ignore
^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debusine/server/views/open_metrics.py", line 74, in registry
registry.register(DebusineCollector())
File "/usr/lib/python3/dist-packages/prometheus_client/registry.py", line 40, in register
names = self._get_names(collector)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/prometheus_client/registry.py", line 80, in _get_names
for metric in desc_func():
File "/usr/lib/python3/dist-packages/debusine/server/open_metrics.py", line 119, in collect
yield self.count_user_identities()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debusine/server/open_metrics.py", line 305, in count_user_identities
(str(int(stat["user__is_active"])), stat["issuer"]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'