Changeset

5850: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 5849:791aa8072f58
children 5851:0ee77be396b9
files mod_http_admin_api/mod_http_admin_api.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
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)