add connected client count metric

This commit is contained in:
Brian Gough 2019-08-14 15:22:03 +01:00
parent 49c7bde799
commit 8270c14d86

View file

@ -56,6 +56,7 @@ module.exports = Router =
client.emit("connectionAccepted")
metrics.inc('socket-io.connection')
metrics.gauge('socket-io.clients', io.sockets.clients()?.length)
logger.log session: session, client_id: client.id, "client connected"
@ -77,6 +78,7 @@ module.exports = Router =
client.on "disconnect", () ->
metrics.inc('socket-io.disconnect')
metrics.gauge('socket-io.clients', io.sockets.clients()?.length)
WebsocketController.leaveProject io, client, (err) ->
if err?
Router._handleError null, err, client, "leaveProject"