Add custom prometheus metrics

This reuses the `realtime.getStatus` method to get the state of the
application state on every prometheus scrape cycle.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-04-18 13:20:43 +02:00
parent 8914df60a9
commit 5c70cc021f
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 51 additions and 0 deletions

2
app.js
View file

@ -26,6 +26,7 @@ const logger = require('./lib/logger')
const errors = require('./lib/errors')
const models = require('./lib/models')
const csp = require('./lib/csp')
const metrics = require('./lib/prometheus')
// server setup
const app = express()
@ -66,6 +67,7 @@ app.use(morgan('combined', {
// Register prometheus metrics endpoint
app.use(apiMetrics())
metrics.setupCustomPrometheusMetrics()
// socket io
const io = require('socket.io')(server, { cookie: false })