# HG changeset patch # User Matthew Wild # Date 1705147395 0 # Node ID f76909ec13000d5b0b63997223227c79e47aa326 # Parent 791aa8072f58745a01973889aa13e422034e2098 mod_http_admin_api: metrics: Filter out a value that is commonly nan at startup The upload bytes count is typically nan at startup, which cannot legally be encoded in JSON. I haven't assessed whether any other metrics might emit nan under other circumstances, but this fixes the most visible issue right now. diff -r 791aa8072f58 -r f76909ec1300 mod_http_admin_api/mod_http_admin_api.lua --- a/mod_http_admin_api/mod_http_admin_api.lua Fri Jan 12 18:21:08 2024 +0000 +++ b/mod_http_admin_api/mod_http_admin_api.lua Sat Jan 13 12:03:15 2024 +0000 @@ -748,7 +748,7 @@ for _, metric in mf:iter_metrics() do sum = sum + metric.value; end - return sum; + return (sum == sum) and sum or nil; -- Filter out nan end local function get_server_metrics(event)