move metrics to /metrics.

This commit is contained in:
Miroslav Šedivý
2022-06-14 22:34:51 +00:00
parent 6deaa64884
commit ef7e9b1a53
2 changed files with 6 additions and 7 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"github.com/go-chi/cors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
@ -41,6 +42,11 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
return config.AllowOrigin(r.Header.Get("Origin"))
}))
router.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
promhttp.Handler().ServeHTTP(w, r)
return nil
})
if config.Static != "" {
fs := http.FileServer(http.Dir(config.Static))
router.Get("/*", func(w http.ResponseWriter, r *http.Request) error {