Add prometheus endpoint at /metrics

This is currently just using the default metrics of prometheus-api-metrics.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-04-18 12:31:28 +02:00
parent dcf72148ce
commit 8914df60a9
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
3 changed files with 162 additions and 6 deletions

4
app.js
View file

@ -18,6 +18,7 @@ const passportSocketIo = require('passport.socketio')
const helmet = require('helmet')
const i18n = require('i18n')
const flash = require('connect-flash')
const apiMetrics = require('prometheus-api-metrics')
// core
const config = require('./lib/config')
@ -63,6 +64,9 @@ app.use(morgan('combined', {
stream: logger.stream
}))
// Register prometheus metrics endpoint
app.use(apiMetrics())
// socket io
const io = require('socket.io')(server, { cookie: false })
io.engine.ws = new (require('ws').Server)({