From 8270c14d86a45b53a97f653ae0c851a3b3044259 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 14 Aug 2019 15:22:03 +0100 Subject: [PATCH] add connected client count metric --- services/real-time/app/coffee/Router.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/real-time/app/coffee/Router.coffee b/services/real-time/app/coffee/Router.coffee index ad74ebffa1..11170d692d 100644 --- a/services/real-time/app/coffee/Router.coffee +++ b/services/real-time/app/coffee/Router.coffee @@ -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"