Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.tasks.notifier.process();
// Start up the cron job processors.
this.scheduledTasks = startScheduledTasks({
mongo: this.mongo,
config: this.config,
mailerQueue: this.tasks.mailer,
tenantCache: this.tenantCache,
signingConfig: this.signingConfig,
});
// If we are running in concurrency mode, and we are the master, we should
// setup the aggregator for the cluster metrics.
if (cluster.isMaster && this.config.get("concurrency") > 1) {
// Create the aggregator registry for metrics.
const aggregatorRegistry = new AggregatorRegistry();
// Setup the cluster metrics server.
const metricsServer = express();
// Setup access logger.
metricsServer.use(accessLogger);
// Add basic auth if provided.
const username = this.config.get("metrics_username");
const password = this.config.get("metrics_password");
if (username && password) {
metricsServer.use("/cluster_metrics", basicAuth(username, password));
logger.info("adding authentication to metrics endpoint");
} else {
logger.info(
"not adding authentication to metrics endpoint, credentials not provided"
function clusterMetrics() {
const aggregatorRegistry = new promClient.AggregatorRegistry();
const metricsMiddleware = function(req, res) {
aggregatorRegistry.clusterMetrics((err, clusterMetrics) => {
if (err) {
console.error(err);
return res.sendStatus(500);
}
res.set('Content-Type', aggregatorRegistry.contentType);
res.send(clusterMetrics);
});
};
return metricsMiddleware;
}