add metrics to queue

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-07-20 16:33:53 +02:00
parent fc41daab5e
commit f0685b44e1
4 changed files with 119 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import {
import { cronJob } from './jobs/cron';
import { eventsJob } from './jobs/events';
import { sessionsJob } from './jobs/sessions';
import { register } from './metrics';
const PORT = parseInt(process.env.WORKER_PORT || '3000', 10);
const serverAdapter = new ExpressAdapter();
@@ -51,6 +52,18 @@ async function start() {
app.use('/', serverAdapter.getRouter());
app.get('/metrics', (req, res) => {
res.set('Content-Type', register.contentType);
register
.metrics()
.then((metrics) => {
res.end(metrics);
})
.catch((error) => {
res.status(500).end(error);
});
});
app.listen(PORT, () => {
console.log(`For the UI, open http://localhost:${PORT}/`);
});