Add prometheus instrumentation, count active ws conns (#8)

* Add prometheus instrumentation, count active ws conns

* Stop bum ticker

* Moving things around

* Handle unspecified host for ws proxy

* Add config reload counter

* metrics: rename conns -> players
This commit is contained in:
Kyle Travis
2020-08-17 10:59:30 -04:00
committed by GitHub
parent 0c54f31fd9
commit 1e1edac3a5
6 changed files with 73 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/prometheus/client_golang/prometheus/promhttp"
quakenet "github.com/criticalstack/quake-kube/internal/quake/net"
)
@ -52,6 +53,8 @@ func NewRouter(cfg *Config) (*echo.Echo, error) {
})
})
e.GET("/metrics", echo.WrapHandler(promhttp.Handler()))
e.GET("/info", func(c echo.Context) error {
m, err := quakenet.GetInfo(cfg.ServerAddr)
if err != nil {