Skip to content

Commit

Permalink
add DEBUG_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenasm committed Oct 24, 2023
1 parent dd8845d commit 22e7837
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ 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 debugMode = process.env.DEBUG_MODE === "true";

const _nodeExporterServiceNameRegex = process.env.NODE_EXPORTER_SERVICE_NAME_REGEX || "";
const useNodeExporter = _nodeExporterServiceNameRegex !== "";
Expand Down Expand Up @@ -546,23 +547,17 @@ if (enableAuthentication) {
}
app.use(pathPrefix + "/", router);

// router.get('/debug-docker-data', (req, res) => {
// fetchDockerData().then(it => res.send(it)).catch(e => res.send(e.toString()));
// });

// router.get('/debug-metrics', (req, res) => {
// fetchMetrics(lastRunningNodeExportes.map(({ address }) => `http://${address}:9100/metrics`)).then(it => res.send(it)).catch(e => res.send(e.toString()));
// });

// router.get('/debug-log', (req, res) => {
// // console.log("lastRunningNodeExportes", lastRunningNodeExportes);
// // console.log("lastNodeMetrics", lastNodeMetrics);
// // console.log("lastRunningCadvisors", lastRunningCadvisors);
// console.log("lastRunningTasksID", lastRunningTasksID);
// // console.log("lastRunningTasksMetrics", lastRunningTasksMetrics);
// console.log("---------------");
// res.send("logged.")
// });
if (debugMode) {
router.get('/debug-log', (req, res) => {
console.log("lastRunningNodeExportes", lastRunningNodeExportes);
console.log("lastNodeMetrics", lastNodeMetrics);
console.log("lastRunningCadvisors", lastRunningCadvisors);
console.log("lastRunningTasksID", lastRunningTasksID);
console.log("lastRunningTasksMetrics", lastRunningTasksMetrics);
console.log("---------------");
res.send("logged.")
});
}

// start the polling

Expand Down

0 comments on commit 22e7837

Please sign in to comment.