mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48: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;
|
cacheData[val.name] = val.count;
|
||||||
} else if (typeof val === "object") {
|
} else if (typeof val === "object") {
|
||||||
setMetrics(val, prefix + key + "-");
|
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
|
// Compute and display percentage of DNS replies in addition to the absolute value
|
||||||
const lval = val.toLocaleString();
|
const lval = val.toLocaleString();
|
||||||
const percent = (100 * val) / data.sum;
|
const percent = (100 * val) / data.sum;
|
||||||
|
|||||||
Reference in New Issue
Block a user