mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-03 07:01:35 -06:00
Metrics (#115)
* metrics add totalRooms and runningRooms. * load initial metrics. * fix.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user