mirror of
https://github.com/pi-hole/web.git
synced 2025-12-22 03:38:29 +00:00
settings-system : Avoid division by zero in DNS metrics
Don't attempt to calculate a percentage if there are no replies yet Signed-off-by: Rob Gill <rrobgill@protonmail.com>
This commit is contained in:
@@ -134,7 +134,7 @@ function setMetrics(data, prefix) {
|
||||
cacheData[val.name] = val.count;
|
||||
} else if (typeof val === "object") {
|
||||
setMetrics(val, prefix + key + "-");
|
||||
} else if (prefix === "sysinfo-dns-replies-") {
|
||||
} else if (prefix === "sysinfo-dns-replies-" && data.sum !== 0) {
|
||||
// Compute and display percentage of DNS replies in addition to the absolute value
|
||||
const lval = val.toLocaleString();
|
||||
const percent = (100 * val) / data.sum;
|
||||
|
||||
Reference in New Issue
Block a user