diff mod_http_admin_api/mod_http_admin_api.lua @ 5827:f76909ec1300

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.
author Matthew Wild <mwild1@gmail.com>
date Sat, 13 Jan 2024 12:03:15 +0000
parents 076b79eb747f
children 9f2816287556
line wrap: on
line diff
--- 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)