1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 18:17:03 +00:00

Add open WebSockets to metrics

This commit is contained in:
James Hillyerd
2017-01-16 18:53:24 -08:00
parent e5aad9f5d0
commit 86365a047c
4 changed files with 22 additions and 1 deletions

View File

@@ -143,7 +143,12 @@ func MonitorAllMessagesV1(
if err != nil {
return err
}
defer conn.Close()
httpd.ExpWebSocketConnectsCurrent.Add(1)
defer func() {
_ = conn.Close()
httpd.ExpWebSocketConnectsCurrent.Add(-1)
}()
log.Tracef("HTTP[%v] Upgraded to websocket", req.RemoteAddr)
// Create, register listener; then interact with conn