* metrics add totalRooms and runningRooms.

* load initial metrics.

* fix.
This commit is contained in:
Miroslav Šedivý
2024-03-03 17:31:18 +01:00
committed by GitHub
parent 74fe2d7eab
commit 44fa2e06e4
5 changed files with 95 additions and 11 deletions
+8
View File
@@ -15,6 +15,8 @@ import (
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
@@ -240,6 +242,12 @@ func New(ApiManager types.ApiManager, roomConfig *config.Room, config *config.Se
logger.Info().Msgf("with pprof endpoint")
}
// mount metrics prometheus endpoint
if config.Metrics {
router.Mount("/metrics", promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{}))
logger.Info().Msgf("with metrics endpoint")
}
// handle all remaining paths with proxy
router.Handle("/*", proxyHandler)