Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.createServer((req, res) => {
console.log(`[Metrics] [info]: ${req.url} was requested.`);
if (url.parse(req.url) === '/metrics') {
res.writeHead(200, { 'Content-Type': register.contentType });
res.write(register.metrics());
res.end();
}
}).listen(5590);
}
server = http.createServer((req, res) => {
if (req.method !== 'GET'
|| parseURL(req.url).pathname !== prometheusConfig.getPath()) {
res.writeHead(400, { 'Content-Type': 'text/plain' });
res.end('Bad Request');
return;
}
res.writeHead(200, {
'Content-Type': register.contentType
});
res.end(register.metrics());
});
router.get("/metrics", noCacheMiddleware, (req, res) => {
res.set("Content-Type", register.contentType);
res.end(register.metrics());
});
logger.info({ path: "/metrics" }, "mounting metrics path on app");
server.get('/metrics', (req, res) => {
res.status(200);
res.set('Content-Type', register.contentType);
res.end(register.metrics());
});
App.get('/metrics', (req, res) => {
res.set('Content-Type', Register.contentType);
res.end(Register.metrics());
});
};
this.get('/prometheus', (req, res) => {
res.set('Content-Type', prometheusRegister.contentType);
res.end(prometheusRegister.metrics());
});
}