introduce consistent logging

This commit is contained in:
Andreas Brett
2021-11-11 12:31:28 +01:00
parent 5df34cd137
commit bdcdf47e52
15 changed files with 290 additions and 201 deletions

View File

@@ -1,4 +1,5 @@
const PrometheusClient = require("prom-client");
const { log } = require("../src/util");
const commonLabels = [
"monitor_name",
@@ -56,20 +57,23 @@ class Prometheus {
}
monitor_cert_is_valid.set(this.monitorLabelValues, is_valid);
} catch (e) {
console.error(e);
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
}
try {
monitor_cert_days_remaining.set(this.monitorLabelValues, tlsInfo.certInfo.daysRemaining);
} catch (e) {
console.error(e);
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
}
}
try {
monitor_status.set(this.monitorLabelValues, heartbeat.status);
} catch (e) {
console.error(e);
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
}
try {
@@ -80,7 +84,8 @@ class Prometheus {
monitor_response_time.set(this.monitorLabelValues, -1);
}
} catch (e) {
console.error(e);
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
}
}