1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47: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

@@ -3,6 +3,7 @@ package httpd
import (
"context"
"expvar"
"fmt"
"net"
"net/http"
@@ -36,8 +37,16 @@ var (
listener net.Listener
sessionStore sessions.Store
globalShutdown chan bool
// ExpWebSocketConnectsCurrent tracks the number of open WebSockets
ExpWebSocketConnectsCurrent = new(expvar.Int)
)
func init() {
m := expvar.NewMap("http")
m.Set("WebSocketConnectsCurrent", ExpWebSocketConnectsCurrent)
}
// Initialize sets up things for unit tests or the Start() method
func Initialize(
cfg config.WebConfig,