Skip to content

Commit

Permalink
fix cpuSecondsTotal for empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenasm committed Oct 24, 2023
1 parent e9fbf11 commit 3df4f64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const enableHTTPS = process.env.ENABLE_HTTPS === "true";
const legoPath = process.env.LEGO_PATH || "/lego-files";
const httpsHostname = process.env.HTTPS_HOSTNAME;
const dockerUpdateInterval = parseInt(process.env.DOCKER_UPDATE_INTERVAL || "1000");
const metricsUpdateInterval = parseInt(process.env.METRICS_UPDATE_INTERVAL|| "5000");
const metricsUpdateInterval = parseInt(process.env.METRICS_UPDATE_INTERVAL || "5000");
const debugMode = process.env.DEBUG_MODE === "true";

const _nodeExporterServiceNameRegex = process.env.NODE_EXPORTER_SERVICE_NAME_REGEX || "";
Expand All @@ -44,7 +44,7 @@ const sha1OfData = data =>
createHash('sha1').update(JSON.stringify(data)).digest('hex');

const sum = (arr) => {
var res = 0; for (let i = 0; i < arr.length; i++) { res += arr[i]; } return res;
var res = undefined; for (let i = 0; i < arr.length; i++) { if (res === undefined) res = 0; res += arr[i]; } return res;
}

function formatBytes(bytes, decimals = 0) {
Expand Down

0 comments on commit 3df4f64

Please sign in to comment.